-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds the block navigation menu to the header (#10545)
- Loading branch information
1 parent
3eaf799
commit e1cc1b2
Showing
20 changed files
with
554 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
packages/editor/src/components/block-navigation/dropdown.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { Fragment } from '@wordpress/element'; | ||
import { IconButton, Dropdown, SVG, Path, KeyboardShortcuts } from '@wordpress/components'; | ||
import { __ } from '@wordpress/i18n'; | ||
import { rawShortcut } from '@wordpress/keycodes'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import BlockNavigation from './'; | ||
|
||
const menuIcon = ( | ||
<SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20"> | ||
<Path d="M5 5H3v2h2V5zm3 8h11v-2H8v2zm9-8H6v2h11V5zM7 11H5v2h2v-2zm0 8h2v-2H7v2zm3-2v2h11v-2H10z" /> | ||
</SVG> | ||
); | ||
|
||
function BlockNavigationDropdown() { | ||
return ( | ||
<Dropdown | ||
renderToggle={ ( { isOpen, onToggle } ) => ( | ||
<Fragment> | ||
<KeyboardShortcuts | ||
bindGlobal | ||
shortcuts={ { | ||
[ rawShortcut.access( 'o' ) ]: onToggle, | ||
} } | ||
/> | ||
<IconButton | ||
icon={ menuIcon } | ||
aria-expanded={ isOpen } | ||
onClick={ onToggle } | ||
label={ __( 'Block Navigation' ) } | ||
/> | ||
</Fragment> | ||
) } | ||
renderContent={ ( { onClose } ) => ( | ||
<BlockNavigation onSelect={ onClose } /> | ||
) } | ||
/> | ||
); | ||
} | ||
|
||
export default BlockNavigationDropdown; |
Oops, something went wrong.