Skip to content

Commit

Permalink
Widget Editor: Hide some settings from the "Options" menu on small sc…
Browse files Browse the repository at this point in the history
…reens (#32690)
  • Loading branch information
Mamaduka authored and youknowriad committed Jun 21, 2021
1 parent 2026214 commit ba36475
Showing 1 changed file with 35 additions and 28 deletions.
63 changes: 35 additions & 28 deletions packages/edit-widgets/src/components/more-menu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { __, _x } from '@wordpress/i18n';
import { external, moreVertical } from '@wordpress/icons';
import { displayShortcut } from '@wordpress/keycodes';
import { useShortcut } from '@wordpress/keyboard-shortcuts';
import { useViewportMatch } from '@wordpress/compose';

/**
* Internal dependencies
Expand Down Expand Up @@ -43,6 +44,8 @@ export default function MoreMenu() {
}
);

const isLargeViewport = useViewportMatch( 'medium' );

return (
<>
<DropdownMenu
Expand All @@ -55,21 +58,23 @@ export default function MoreMenu() {
>
{ () => (
<>
<MenuGroup label={ _x( 'View', 'noun' ) }>
<FeatureToggle
feature="fixedToolbar"
label={ __( 'Top toolbar' ) }
info={ __(
'Access all block and document tools in a single place'
) }
messageActivated={ __(
'Top toolbar activated'
) }
messageDeactivated={ __(
'Top toolbar deactivated'
) }
/>
</MenuGroup>
{ isLargeViewport && (
<MenuGroup label={ _x( 'View', 'noun' ) }>
<FeatureToggle
feature="fixedToolbar"
label={ __( 'Top toolbar' ) }
info={ __(
'Access all block and document tools in a single place'
) }
messageActivated={ __(
'Top toolbar activated'
) }
messageDeactivated={ __(
'Top toolbar deactivated'
) }
/>
</MenuGroup>
) }
<MenuGroup label={ __( 'Tools' ) }>
<MenuItem
onClick={ () => {
Expand Down Expand Up @@ -117,19 +122,21 @@ export default function MoreMenu() {
'Contain text cursor inside block deactivated'
) }
/>
<FeatureToggle
feature="showBlockBreadcrumbs"
label={ __( 'Display block breadcrumbs' ) }
info={ __(
'Shows block breadcrumbs at the bottom of the editor.'
) }
messageActivated={ __(
'Display block breadcrumbs activated'
) }
messageDeactivated={ __(
'Display block breadcrumbs deactivated'
) }
/>
{ isLargeViewport && (
<FeatureToggle
feature="showBlockBreadcrumbs"
label={ __( 'Display block breadcrumbs' ) }
info={ __(
'Shows block breadcrumbs at the bottom of the editor.'
) }
messageActivated={ __(
'Display block breadcrumbs activated'
) }
messageDeactivated={ __(
'Display block breadcrumbs deactivated'
) }
/>
) }
</MenuGroup>
</>
) }
Expand Down

0 comments on commit ba36475

Please sign in to comment.