Skip to content

Commit

Permalink
Add menu icon.
Browse files Browse the repository at this point in the history
  • Loading branch information
jasmussen committed Mar 22, 2021
1 parent 9a4c0cd commit 524f512
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
9 changes: 5 additions & 4 deletions packages/block-library/src/navigation/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
} from '@wordpress/components';
import { compose } from '@wordpress/compose';
import { __ } from '@wordpress/i18n';
import { closeSmall, Icon } from '@wordpress/icons';
import { closeSmall, menu, Icon } from '@wordpress/icons';

/**
* Internal dependencies
Expand Down Expand Up @@ -160,13 +160,14 @@ function Navigation( {
</InspectorControls>
<nav { ...blockProps }>
<Button
data-micromodal-trigger="modal-1"
className="wp-block-navigation__responsive-container-open "
aria-label="Close menu"
data-micromodal-trigger="modal-1"
onClick={ () =>
setResponsiveMenuOpen( ! isResponsiveMenuOpen )
}
>
Open Menu
<Icon icon={ menu } />
</Button>

<div
Expand All @@ -187,7 +188,7 @@ function Navigation( {
>
<Button
className="wp-block-navigation__responsive-container-close"
aria-label="Close modal"
aria-label="Close menu"
data-micromodal-close
onClick={ () => {
setResponsiveMenuOpen( false );
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/navigation/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,11 @@ function render_block_core_navigation( $attributes, $content, $block ) {

$responsive_container_markup = sprintf(
'
<div class="wp-block-navigation__responsive-container-open" data-micromodal-trigger="modal-1">Open Menu</div>
<div class="wp-block-navigation__responsive-container-open" data-micromodal-trigger="modal-1" aria-label="Open menu"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" role="img" aria-hidden="true" focusable="false"><path d="M5 5.5V7h14V5.5H5zM5 13h14v-1.5H5V13zm0 6h14v-1.5H5V19z"></path></svg></div>
<div class="wp-block-navigation__responsive-container" id="modal-1" aria-hidden="true">
<div class="wp-block-navigation__responsive-close" tabindex="-1" data-micromodal-close>
<div class="wp-block-navigation__responsive-dialog" role="dialog" aria-modal="true" aria-labelledby="modal-1-title" >
<button aria-label="Close modal" data-micromodal-close class="wp-block-navigation__responsive-container-close"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" role="img" aria-hidden="true" focusable="false"><path d="M13 11.9l3.3-3.4-1.1-1-3.2 3.3-3.2-3.3-1.1 1 3.3 3.4-3.5 3.6 1 1L12 13l3.5 3.5 1-1z"></path></svg></button>
<button aria-label="Close menu" data-micromodal-close class="wp-block-navigation__responsive-container-close"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" role="img" aria-hidden="true" focusable="false"><path d="M13 11.9l3.3-3.4-1.1-1-3.2 3.3-3.2-3.3-1.1 1 3.3 3.4-3.5 3.6 1 1L12 13l3.5 3.5 1-1z"></path></svg></button>
<div class="wp-block-navigation__responsive-content" id="modal-1-content">
<ul class="wp-block-navigation__container">%1$s</ul>
</div>
Expand Down
3 changes: 2 additions & 1 deletion packages/block-library/src/navigation/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,11 @@
position: absolute;
top: 60px;
right: 16px;
color: #fff;
color: currentColor;

svg {
fill: currentColor;
pointer-events: none;
}

@include break-mobile() {
Expand Down

0 comments on commit 524f512

Please sign in to comment.