Skip to content

Commit

Permalink
Add arrow navigation to Warning dropdown menu (#24333)
Browse files Browse the repository at this point in the history
* add arrow navigation to warning dropdown menu

* use svg icon directly

* use noIcons DropdownMenu prop
  • Loading branch information
ntsekouras committed Aug 3, 2020
1 parent 8d6a3e6 commit 9bebc90
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions packages/block-editor/src/components/warning/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import classnames from 'classnames';
* WordPress dependencies
*/
import { Children } from '@wordpress/element';
import { Dropdown, Button, MenuGroup, MenuItem } from '@wordpress/components';
import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { moreHorizontal } from '@wordpress/icons';

Expand All @@ -29,19 +29,17 @@ function Warning( { className, actions, children, secondaryActions } ) {
</span>
) ) }
{ secondaryActions && (
<Dropdown
<DropdownMenu
className="block-editor-warning__secondary"
contentClassName="block-editor-warning__dropdown"
position="bottom left"
renderToggle={ ( { isOpen, onToggle } ) => (
<Button
icon={ moreHorizontal }
label={ __( 'More options' ) }
onClick={ onToggle }
aria-expanded={ isOpen }
/>
) }
renderContent={ () => (
icon={ moreHorizontal }
label={ __( 'More options' ) }
popoverProps={ {
position: 'bottom left',
className: 'block-editor-warning__dropdown',
} }
noIcons
>
{ () => (
<MenuGroup>
{ secondaryActions.map(
( item, pos ) => (
Expand All @@ -55,7 +53,7 @@ function Warning( { className, actions, children, secondaryActions } ) {
) }
</MenuGroup>
) }
/>
</DropdownMenu>
) }
</div>
) }
Expand Down

0 comments on commit 9bebc90

Please sign in to comment.