Last active
July 16, 2019 20:38
-
-
Save leanazulyoro/2dbd1f8c1431371a00f96064bcc2beb9 to your computer and use it in GitHub Desktop.
LeadListWithRevisionModal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from 'react'; | |
const LeadListWithRevisionModal = ({ leads }) => { | |
const [isRevisionModalOpen, setRevisionModalOpen] = useState(false); | |
const [leadInRevision, setLeadInRevision] = useState(null); | |
const handleRevisionRequest = (lead) => { | |
setLeadInRevision(lead); | |
setRevisionModalOpen(!isRevisionModalOpen); | |
}; | |
return ( | |
<> | |
<LeadList | |
leads={leads} | |
onRevisionRequest={handleRevisionRequest} | |
/> | |
{leadInRevision ? ( | |
<RevisionModal | |
onToggle={() => { setRevisionModalOpen(!isRevisionModalOpen); }} | |
isOpen={isRevisionModalOpen} | |
lead={leadInRevision} | |
/> | |
) : null} | |
</> | |
); | |
}; | |
export default LeadListWithRevisionModal; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment