Hide the recommended channels section if it is empty.

This commit is contained in:
Gan Eng Chin 2022-12-20 22:39:00 +08:00
parent 17f2072d9f
commit 24d59f7316
No known key found for this signature in database
GPG Key ID: 94D5D972860ADB01
1 changed files with 21 additions and 15 deletions

View File

@ -44,21 +44,27 @@ export const CampaignsCardHeader = () => {
) }
</div>
{ /* TODO: list of campaign type here. */ }
<Button
variant="link"
onClick={ () => setCollapsed( ! collapsed ) }
>
{ __(
'Add channels for other campaign types',
'woocommerce'
) }
<Icon
icon={ collapsed ? chevronDown : chevronUp }
size={ 24 }
/>
</Button>
{ ! collapsed && (
<RecommendedChannelsList recommendedChannels={ data } />
{ data.length > 0 && (
<>
<Button
variant="link"
onClick={ () => setCollapsed( ! collapsed ) }
>
{ __(
'Add channels for other campaign types',
'woocommerce'
) }
<Icon
icon={ collapsed ? chevronDown : chevronUp }
size={ 24 }
/>
</Button>
{ ! collapsed && (
<RecommendedChannelsList
recommendedChannels={ data }
/>
) }
</>
) }
</Modal>
) }