Skip to content

Commit

Permalink
remove number in font size presets drilldown
Browse files Browse the repository at this point in the history
  • Loading branch information
matiasbenedetto committed Jul 4, 2024
1 parent 7752e21 commit 1a22c99
Showing 1 changed file with 2 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/**
* WordPress dependencies
*/
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
import { __, _n, sprintf, isRTL } from '@wordpress/i18n';
import { __, isRTL } from '@wordpress/i18n';
import {
__experimentalItemGroup as ItemGroup,
__experimentalVStack as VStack,
Expand All @@ -14,26 +13,10 @@ import { Icon, chevronLeft, chevronRight } from '@wordpress/icons';
/**
* Internal dependencies
*/
import { unlock } from '../../../lock-unlock';
const { useGlobalSetting } = unlock( blockEditorPrivateApis );
import Subtitle from '../subtitle';
import { NavigationButtonAsItem } from '../navigation-button';

function FontSizes() {
const [ fontSizes ] = useGlobalSetting( 'typography.fontSizes' );

const [ defaultFontSizesEnabled ] = useGlobalSetting(
'typography.defaultFontSizes'
);

// Count the number of font sizes from the theme or use the default ones.
const fontSizesCount = [
// Default font sizes are only counted if enabled.
...( defaultFontSizesEnabled ? fontSizes.default || [] : [] ),
...( fontSizes.theme || [] ),
...( fontSizes.custom || [] ),
].length;

return (
<VStack spacing={ 2 }>
<HStack justify="space-between">
Expand All @@ -45,17 +28,7 @@ function FontSizes() {
aria-label={ __( 'Edit font size presets' ) }
>
<HStack direction="row">
<FlexItem>
{ sprintf(
/* translators: %d: number of font sizes */
_n(
'%d Font size preset',
'%d Font size presets',
fontSizesCount
),
fontSizesCount
) }
</FlexItem>
<FlexItem>{ __( 'Font size presets' ) }</FlexItem>
<Icon icon={ isRTL() ? chevronLeft : chevronRight } />
</HStack>
</NavigationButtonAsItem>
Expand Down

0 comments on commit 1a22c99

Please sign in to comment.