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

Menu granular subcomponents: Refactor global styles font size menus #67642

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -27,14 +27,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 @@ -81,24 +82,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
Loading