Skip to content

Commit

Permalink
Refactored to target mobile navigation styles exclusively for navigat…
Browse files Browse the repository at this point in the history
…ion blocks in the header.
  • Loading branch information
pbking committed Mar 16, 2021
1 parent b4b1fe0 commit bd33898
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion blank-canvas-blocks/assets/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
}

window.addEventListener( 'load', () => {
Array.from( document.querySelectorAll( '.wp-block-navigation.is___experimental-mobile' ) )
Array.from( document.querySelectorAll( 'header .wp-block-navigation' ) )
.forEach( addMobileMenuButton );
});

Expand Down
14 changes: 7 additions & 7 deletions blank-canvas-blocks/assets/ponyfill.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions blank-canvas-blocks/block-template-parts/header.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<!-- wp:navigation {"orientation":"horizontal","itemsJustification":"right"} -->
<!-- /wp:navigation -->
3 changes: 1 addition & 2 deletions blank-canvas-blocks/block-templates/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<!-- wp:navigation {"orientation":"horizontal","itemsJustification":"right"} -->
<!-- /wp:navigation -->
<!-- wp:template-part {"slug":"header","tagName":"header"} /-->

<!-- wp:query -->
<!-- wp:query-loop -->
Expand Down
8 changes: 4 additions & 4 deletions blank-canvas-blocks/sass/blocks/_navigation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,26 @@
}

@include media(mobile) {
.wp-block-navigation.is___experimental-mobile {
header .wp-block-navigation {
.wp-block-navigation__mobile-menu-open-button {
display:none;
}
}
}

@include media(mobile-only) {
.wp-block-navigation.is___experimental-mobile:not(.show) {
header .wp-block-navigation:not(.show) {
.wp-block-navigation__container {
display: none;
}
}
.wp-block-navigation.is___experimental-mobile:not(.show) {
header .wp-block-navigation:not(.show) {
font-size: var(--wp--custom--navigation--mobile--menu--typography--font-size);
font-weight: var(--wp--custom--navigation--mobile--menu--typography--font-weight);
font-family: var(--wp--custom--navigation--mobile--menu--typography--font-family);
text-align: right;
}
.wp-block-navigation.is___experimental-mobile.show {
header .wp-block-navigation.show {
opacity: 1;
position:absolute;
top: 0;
Expand Down

0 comments on commit bd33898

Please sign in to comment.