2022-12-26 18:05:58 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import { __ } from '@wordpress/i18n';
|
2023-03-07 16:37:55 +00:00
|
|
|
import { useState } from '@wordpress/element';
|
2022-12-27 12:47:14 +00:00
|
|
|
import { Card, Flex, FlexItem, FlexBlock, Button } from '@wordpress/components';
|
2022-12-27 13:06:26 +00:00
|
|
|
import { Icon, trendingUp, megaphone, closeSmall } from '@wordpress/icons';
|
2022-12-26 18:05:58 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
2023-03-07 16:37:55 +00:00
|
|
|
import { CreateNewCampaignModal } from '~/marketing/components';
|
2022-12-27 16:56:59 +00:00
|
|
|
import { hashAddChannels } from '~/marketing/overview-multichannel/constants';
|
2022-12-26 18:05:58 +00:00
|
|
|
import './IntroductionBanner.scss';
|
|
|
|
import wooIconUrl from './woo.svg';
|
|
|
|
import illustrationUrl from './illustration.svg';
|
2022-12-27 13:06:26 +00:00
|
|
|
import illustrationLargeUrl from './illustration-large.svg';
|
2022-12-26 18:05:58 +00:00
|
|
|
|
2022-12-27 13:06:26 +00:00
|
|
|
type IntroductionBannerProps = {
|
|
|
|
showButtons: boolean;
|
2022-12-27 14:01:46 +00:00
|
|
|
onDismiss: () => void;
|
2022-12-27 13:06:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export const IntroductionBanner = ( {
|
|
|
|
showButtons,
|
2022-12-27 14:01:46 +00:00
|
|
|
onDismiss,
|
2022-12-27 13:06:26 +00:00
|
|
|
}: IntroductionBannerProps ) => {
|
2023-03-07 16:37:55 +00:00
|
|
|
const [ open, setOpen ] = useState( false );
|
|
|
|
|
2022-12-26 18:05:58 +00:00
|
|
|
return (
|
|
|
|
<Card className="woocommerce-marketing-introduction-banner">
|
|
|
|
<div className="woocommerce-marketing-introduction-banner-content">
|
|
|
|
<div className="woocommerce-marketing-introduction-banner-title">
|
|
|
|
{ __(
|
|
|
|
'Reach new customers and increase sales without leaving WooCommerce',
|
|
|
|
'woocommerce'
|
|
|
|
) }
|
|
|
|
</div>
|
|
|
|
<Flex
|
|
|
|
className="woocommerce-marketing-introduction-banner-features"
|
|
|
|
direction="column"
|
|
|
|
gap={ 1 }
|
|
|
|
expanded={ false }
|
|
|
|
>
|
|
|
|
<FlexItem>
|
|
|
|
<Flex>
|
|
|
|
<Icon icon={ trendingUp } />
|
|
|
|
<FlexBlock>
|
|
|
|
{ __(
|
|
|
|
'Reach customers on other sales channels',
|
|
|
|
'woocommerce'
|
|
|
|
) }
|
|
|
|
</FlexBlock>
|
|
|
|
</Flex>
|
|
|
|
</FlexItem>
|
|
|
|
<FlexItem>
|
|
|
|
<Flex>
|
|
|
|
<Icon icon={ megaphone } />
|
|
|
|
<FlexBlock>
|
|
|
|
{ __(
|
|
|
|
'Advertise with marketing campaigns',
|
|
|
|
'woocommerce'
|
|
|
|
) }
|
|
|
|
</FlexBlock>
|
|
|
|
</Flex>
|
|
|
|
</FlexItem>
|
|
|
|
<FlexItem>
|
|
|
|
<Flex>
|
|
|
|
<Icon
|
|
|
|
icon={
|
|
|
|
<img
|
|
|
|
src={ wooIconUrl }
|
|
|
|
alt={ __(
|
|
|
|
'WooCommerce logo',
|
|
|
|
'woocommerce'
|
|
|
|
) }
|
|
|
|
width="24"
|
|
|
|
height="24"
|
|
|
|
/>
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
<FlexBlock>
|
|
|
|
{ __( 'Built by WooCommerce', 'woocommerce' ) }
|
|
|
|
</FlexBlock>
|
|
|
|
</Flex>
|
|
|
|
</FlexItem>
|
|
|
|
</Flex>
|
2022-12-27 13:06:26 +00:00
|
|
|
{ showButtons && (
|
|
|
|
<Flex
|
|
|
|
className="woocommerce-marketing-introduction-banner-buttons"
|
|
|
|
justify="flex-start"
|
|
|
|
>
|
|
|
|
<Button
|
|
|
|
variant="primary"
|
|
|
|
onClick={ () => {
|
2023-03-07 16:37:55 +00:00
|
|
|
setOpen( true );
|
2022-12-27 13:06:26 +00:00
|
|
|
} }
|
|
|
|
>
|
|
|
|
{ __( 'Create a campaign', 'woocommerce' ) }
|
|
|
|
</Button>
|
2022-12-27 16:56:59 +00:00
|
|
|
<Button variant="secondary" href={ hashAddChannels }>
|
2022-12-27 13:06:26 +00:00
|
|
|
{ __( 'Add channels', 'woocommerce' ) }
|
|
|
|
</Button>
|
|
|
|
</Flex>
|
|
|
|
) }
|
2023-03-07 16:37:55 +00:00
|
|
|
{ open && (
|
|
|
|
<CreateNewCampaignModal
|
|
|
|
onRequestClose={ () => setOpen( false ) }
|
|
|
|
/>
|
|
|
|
) }
|
2022-12-26 18:05:58 +00:00
|
|
|
</div>
|
|
|
|
<div className="woocommerce-marketing-introduction-banner-illustration">
|
2022-12-27 12:47:14 +00:00
|
|
|
<Button
|
|
|
|
isSmall
|
|
|
|
className="woocommerce-marketing-introduction-banner-close-button"
|
2022-12-27 14:01:46 +00:00
|
|
|
onClick={ onDismiss }
|
2022-12-27 12:47:14 +00:00
|
|
|
>
|
|
|
|
<Icon icon={ closeSmall } />
|
|
|
|
</Button>
|
2022-12-26 18:05:58 +00:00
|
|
|
<img
|
2022-12-27 13:06:26 +00:00
|
|
|
src={ showButtons ? illustrationLargeUrl : illustrationUrl }
|
2022-12-26 18:05:58 +00:00
|
|
|
alt={ __(
|
|
|
|
'WooCommerce Marketing introduction banner illustration',
|
|
|
|
'woocommerce'
|
|
|
|
) }
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</Card>
|
|
|
|
);
|
|
|
|
};
|