From 0b022f51850d00c3cc0f174c2832522524cb8e1c Mon Sep 17 00:00:00 2001 From: Marco Ciampini Date: Wed, 11 Dec 2024 16:51:42 +0100 Subject: [PATCH] Refactor global styles font size menus (#67642) --- .../global-styles/font-sizes/font-size.js | 47 ++++++++++-------- .../global-styles/font-sizes/font-sizes.js | 48 +++++++++++-------- 2 files changed, 56 insertions(+), 39 deletions(-) diff --git a/packages/edit-site/src/components/global-styles/font-sizes/font-size.js b/packages/edit-site/src/components/global-styles/font-sizes/font-size.js index 25dcc69185cae..cca4a26e1b736 100644 --- a/packages/edit-site/src/components/global-styles/font-sizes/font-size.js +++ b/packages/edit-site/src/components/global-styles/font-sizes/font-size.js @@ -166,25 +166,34 @@ function FontSize() { marginBottom={ 0 } paddingX={ 4 } > - - } - > - - - { __( 'Rename' ) } - - - - - { __( 'Delete' ) } - - + + + } + /> + + + + { __( 'Rename' ) } + + + + + { __( 'Delete' ) } + + + diff --git a/packages/edit-site/src/components/global-styles/font-sizes/font-sizes.js b/packages/edit-site/src/components/global-styles/font-sizes/font-sizes.js index 7498dd7c78fb3..5b759d1e0468d 100644 --- a/packages/edit-site/src/components/global-styles/font-sizes/font-sizes.js +++ b/packages/edit-site/src/components/global-styles/font-sizes/font-sizes.js @@ -26,14 +26,15 @@ import { useState } from '@wordpress/element'; * Internal dependencies */ import { unlock } from '../../../lock-unlock'; -const { Menu } = unlock( componentsPrivateApis ); -const { useGlobalSetting } = unlock( blockEditorPrivateApis ); import Subtitle from '../subtitle'; import { NavigationButtonAsItem } from '../navigation-button'; import { getNewIndexFromPresets } from '../utils'; import ScreenHeader from '../header'; import ConfirmResetFontSizesDialog from './confirm-reset-font-sizes-dialog'; +const { Menu } = unlock( componentsPrivateApis ); +const { useGlobalSetting } = unlock( blockEditorPrivateApis ); + function FontSizeGroup( { label, origin, @@ -80,24 +81,31 @@ function FontSizeGroup( { /> ) } { !! handleResetFontSizes && ( - - } - > - - - { origin === 'custom' - ? __( 'Remove font size presets' ) - : __( 'Reset font size presets' ) } - - + + + } + /> + + + + { origin === 'custom' + ? __( + 'Remove font size presets' + ) + : __( + 'Reset font size presets' + ) } + + + ) }