Skip to content

Commit

Permalink
Display device icon on "preview" and "view" buttons (#50218)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtias authored May 2, 2023
1 parent ecbde0e commit bdb22cd
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/block-editor/src/components/preview-options/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import classnames from 'classnames';
import { useViewportMatch } from '@wordpress/compose';
import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { check } from '@wordpress/icons';
import { check, desktop, mobile, tablet } from '@wordpress/icons';

export default function PreviewOptions( {
children,
Expand Down Expand Up @@ -38,13 +38,20 @@ export default function PreviewOptions( {
const menuProps = {
'aria-label': __( 'View options' ),
};

const deviceIcons = {
mobile,
tablet,
desktop,
};

return (
<DropdownMenu
className="block-editor-post-preview__dropdown"
popoverProps={ popoverProps }
toggleProps={ toggleProps }
menuProps={ menuProps }
icon={ null }
icon={ deviceIcons[ deviceType.toLowerCase() ] }
>
{ () => (
<>
Expand Down

0 comments on commit bdb22cd

Please sign in to comment.