Skip to content

Commit

Permalink
Refactor global styles font size menus (#67642)
Browse files Browse the repository at this point in the history
  • Loading branch information
ciampo committed Dec 12, 2024
1 parent e79e041 commit 0b022f5
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,25 +166,34 @@ function FontSize() {
marginBottom={ 0 }
paddingX={ 4 }
>
<Menu
trigger={
<Button
size="small"
icon={ moreVertical }
label={ __( 'Font size options' ) }
/>
}
>
<Menu.Item onClick={ toggleRenameDialog }>
<Menu.ItemLabel>
{ __( 'Rename' ) }
</Menu.ItemLabel>
</Menu.Item>
<Menu.Item onClick={ toggleDeleteConfirm }>
<Menu.ItemLabel>
{ __( 'Delete' ) }
</Menu.ItemLabel>
</Menu.Item>
<Menu>
<Menu.TriggerButton
render={
<Button
size="small"
icon={ moreVertical }
label={ __(
'Font size options'
) }
/>
}
/>
<Menu.Popover>
<Menu.Item
onClick={ toggleRenameDialog }
>
<Menu.ItemLabel>
{ __( 'Rename' ) }
</Menu.ItemLabel>
</Menu.Item>
<Menu.Item
onClick={ toggleDeleteConfirm }
>
<Menu.ItemLabel>
{ __( 'Delete' ) }
</Menu.ItemLabel>
</Menu.Item>
</Menu.Popover>
</Menu>
</Spacer>
</FlexItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -80,24 +81,31 @@ function FontSizeGroup( {
/>
) }
{ !! handleResetFontSizes && (
<Menu
trigger={
<Button
size="small"
icon={ moreVertical }
label={ __(
'Font size presets options'
) }
/>
}
>
<Menu.Item onClick={ toggleResetDialog }>
<Menu.ItemLabel>
{ origin === 'custom'
? __( 'Remove font size presets' )
: __( 'Reset font size presets' ) }
</Menu.ItemLabel>
</Menu.Item>
<Menu>
<Menu.TriggerButton
render={
<Button
size="small"
icon={ moreVertical }
label={ __(
'Font size presets options'
) }
/>
}
/>
<Menu.Popover>
<Menu.Item onClick={ toggleResetDialog }>
<Menu.ItemLabel>
{ origin === 'custom'
? __(
'Remove font size presets'
)
: __(
'Reset font size presets'
) }
</Menu.ItemLabel>
</Menu.Item>
</Menu.Popover>
</Menu>
) }
</FlexItem>
Expand Down

0 comments on commit 0b022f5

Please sign in to comment.