Skip to content

Commit

Permalink
try stacking with device previews
Browse files Browse the repository at this point in the history
  • Loading branch information
richtabor committed Jan 29, 2024
1 parent ae35378 commit 8b8f2fb
Showing 1 changed file with 12 additions and 22 deletions.
34 changes: 12 additions & 22 deletions packages/editor/src/components/preview-dropdown/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,7 @@ import {
Icon,
} from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import {
check,
desktop,
mobile,
tablet,
external,
chevronUpDown,
} from '@wordpress/icons';
import { check, desktop, mobile, tablet, external } from '@wordpress/icons';
import { useSelect, useDispatch } from '@wordpress/data';
import { store as coreStore } from '@wordpress/core-data';
import { store as preferencesStore } from '@wordpress/preferences';
Expand Down Expand Up @@ -86,11 +79,7 @@ export default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {
popoverProps={ popoverProps }
toggleProps={ toggleProps }
menuProps={ menuProps }
icon={
isZoomedOutView
? chevronUpDown
: deviceIcons[ deviceType.toLowerCase() ]
}
icon={ deviceIcons[ deviceType.toLowerCase() ] }
label={ __( 'View' ) }
disableOpenOnArrowDown={ disabled }
>
Expand All @@ -102,11 +91,7 @@ export default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {
setDeviceType( 'Desktop' );
__unstableSetEditorMode( 'edit' );
} }
icon={
deviceType === 'Desktop' &&
! isZoomedOutView &&
check
}
icon={ deviceType === 'Desktop' && check }
>
{ __( 'Desktop' ) }
</MenuItem>
Expand All @@ -133,10 +118,15 @@ export default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {
<MenuGroup>
<MenuItem
onClick={ () => {
setDeviceType( 'Desktop' );
__unstableSetEditorMode(
isZoomedOutView ? 'edit' : 'zoom-out'
);
__unstableSetEditorMode( 'edit' );
} }
icon={ ! isZoomedOutView && check }
>
{ __( 'Zoom to 100%' ) }
</MenuItem>
<MenuItem
onClick={ () => {
__unstableSetEditorMode( 'zoom-out' );
} }
icon={ isZoomedOutView && check }
>
Expand Down

0 comments on commit 8b8f2fb

Please sign in to comment.