Rename open and setOpen to isModalOpen and setModalOpen in Campaigns.

This commit is contained in:
Gan Eng Chin 2023-03-09 22:11:53 +08:00
parent e831e89997
commit f5bb8490ea
No known key found for this signature in database
GPG Key ID: 94D5D972860ADB01
1 changed files with 7 additions and 4 deletions

View File

@ -60,7 +60,7 @@ const perPage = 5;
*/
export const Campaigns = () => {
const [ page, setPage ] = useState( 1 );
const [ open, setOpen ] = useState( false );
const [ isModalOpen, setModalOpen ] = useState( false );
const {
loading: loadingCampaigns,
data,
@ -172,12 +172,15 @@ export const Campaigns = () => {
<CardHeaderTitle>
{ __( 'Campaigns', 'woocommerce' ) }
</CardHeaderTitle>
<Button variant="secondary" onClick={ () => setOpen( true ) }>
<Button
variant="secondary"
onClick={ () => setModalOpen( true ) }
>
{ __( 'Create new campaign', 'woocommerce' ) }
</Button>
{ open && (
{ isModalOpen && (
<CreateNewCampaignModal
onRequestClose={ () => setOpen( false ) }
onRequestClose={ () => setModalOpen( false ) }
/>
) }
</CardHeader>