From 08661353eb15d1b074ba1c0da02e993433e6f497 Mon Sep 17 00:00:00 2001 From: Gan Eng Chin Date: Tue, 20 Dec 2022 01:17:30 +0800 Subject: [PATCH] Add CampaignsCardHeader component with modal. --- .../Campaigns/Campaigns.scss | 9 +++ .../Campaigns/Campaigns.tsx | 32 ++-------- .../Campaigns/CampaignsCardHeader.tsx | 59 +++++++++++++++++++ 3 files changed, 73 insertions(+), 27 deletions(-) create mode 100644 plugins/woocommerce-admin/client/marketing/overview-multichannel/Campaigns/CampaignsCardHeader.tsx diff --git a/plugins/woocommerce-admin/client/marketing/overview-multichannel/Campaigns/Campaigns.scss b/plugins/woocommerce-admin/client/marketing/overview-multichannel/Campaigns/Campaigns.scss index 4e664f425b0..d2eb4e2cda9 100644 --- a/plugins/woocommerce-admin/client/marketing/overview-multichannel/Campaigns/Campaigns.scss +++ b/plugins/woocommerce-admin/client/marketing/overview-multichannel/Campaigns/Campaigns.scss @@ -50,3 +50,12 @@ border-top: none; } } + +.woocommerce-marketing-create-campaign-modal { + &__question-label { + font-size: 14px; + font-weight: 600; + line-height: 17px; + margin-bottom: 16px; + } +} diff --git a/plugins/woocommerce-admin/client/marketing/overview-multichannel/Campaigns/Campaigns.tsx b/plugins/woocommerce-admin/client/marketing/overview-multichannel/Campaigns/Campaigns.tsx index e7448cea653..244b5b206d9 100644 --- a/plugins/woocommerce-admin/client/marketing/overview-multichannel/Campaigns/Campaigns.tsx +++ b/plugins/woocommerce-admin/client/marketing/overview-multichannel/Campaigns/Campaigns.tsx @@ -4,9 +4,7 @@ import { __ } from '@wordpress/i18n'; import { useState } from '@wordpress/element'; import { - Button, Card, - CardHeader, CardBody, CardFooter, Flex, @@ -19,9 +17,10 @@ import { Pagination, Table } from '@woocommerce/components'; /** * Internal dependencies */ -import { CardHeaderTitle, CenteredSpinner } from '~/marketing/components'; +import { CenteredSpinner } from '~/marketing/components'; import { useCampaigns } from './useCampaigns'; import './Campaigns.scss'; +import { CampaignsCardHeader } from './CampaignsCardHeader'; export const Campaigns = () => { const [ page, setPage ] = useState( 1 ); @@ -30,14 +29,7 @@ export const Campaigns = () => { if ( loading ) { return ( - - - { __( 'Campaigns', 'woocommerce' ) } - - - + @@ -48,14 +40,7 @@ export const Campaigns = () => { if ( data.length === 0 ) { return ( - - - { __( 'Campaigns', 'woocommerce' ) } - - - +
@@ -82,14 +67,7 @@ export const Campaigns = () => { return ( - - - { __( 'Campaigns', 'woocommerce' ) } - - - + { + const [ open, setOpen ] = useState( false ); + const [ collapsed, setCollapsed ] = useState( true ); + const openModal = () => setOpen( true ); + const closeModal = () => setOpen( false ); + + return ( + + + { __( 'Campaigns', 'woocommerce' ) } + + + { open && ( + +
+ { __( + 'Where would you like to promote your products?', + 'woocommerce' + ) } +
+ { /* TODO: list of campaign type here. */ } + + { /* TODO: list of recommended channels here. */ } +
+ ) } +
+ ); +};