Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add button text when no colors found #36684

Merged
merged 2 commits into from Nov 23, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 10 additions & 8 deletions packages/edit-site/src/components/global-styles/palette.js
Expand Up @@ -27,13 +27,21 @@ function Palette( { name } ) {
const screenPath = ! name
? '/colors/palette'
: '/blocks/' + name + '/colors/palette';
const palleteButtonText =
colors.length > 0
? sprintf(
// Translators: %d: Number of palette colors.
_n( '%d color', '%d colors', colors.length ),
colors.length
)
: __( 'Add custom colors' );

return (
<VStack spacing={ 3 }>
<Subtitle>{ __( 'Palette' ) }</Subtitle>
<ItemGroup isBordered isSeparated>
<NavigationButton path={ screenPath }>
<HStack>
<HStack isReversed={ colors.length === 0 }>
<FlexBlock>
<ZStack isLayered={ false } offset={ -8 }>
{ colors.slice( 0, 5 ).map( ( { color } ) => (
Expand All @@ -44,13 +52,7 @@ function Palette( { name } ) {
) ) }
</ZStack>
</FlexBlock>
<FlexItem>
{ sprintf(
// Translators: %d: Number of palette colors.
_n( '%d color', '%d colors', colors.length ),
colors.length
) }
</FlexItem>
<FlexItem>{ palleteButtonText }</FlexItem>
</HStack>
</NavigationButton>
</ItemGroup>
Expand Down