Skip to content

Commit

Permalink
Merge pull request #76 from devgeniem/TMS-102-2
Browse files Browse the repository at this point in the history
TMS-102: Minor bugfixes
  • Loading branch information
Viljami Hirvonen authored Jun 17, 2021
2 parents 4762b1a + b81319d commit 4b6e836
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

### Fixed

- TMS-102-2: Hide menu toggle if navigation does not exist #76
- TMS-102-1: Add screen reader text to menu toggle #74
- TMS-102-1: Fix quote align #74
- Fixed cross-origin asset loading, added .no-hyphens
Expand Down
9 changes: 9 additions & 0 deletions models/shared/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,4 +215,13 @@ public function head_custom_scripts() {
public function hide_search() {
return Settings::get_setting( 'hide_search' );
}

/**
* Check if navigation menu exists
*
* @return bool
*/
public function has_nav_menu() : bool {
return has_nav_menu( 'primary' ) || has_nav_menu( 'secondary' );
}
}
10 changes: 6 additions & 4 deletions partials/shared/header-inner.dust
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@
{>"shared/header-search-toggle" /}
{/Header.hide_search}

<button class="fly-out-nav__trigger {?Header.hide_search}ml-4{/Header.hide_search} {^Header.hide_main_nav}is-hidden-widescreen{/Header.hide_main_nav}" data-micromodal-trigger="js-fly-out-nav">
{>"ui/icon" icon="burger" class="icon--large" /}
<span class="is-sr-only">{Strings.s.header.open_menu|s}</span>
</button>
{?Header.has_nav_menu}
<button class="fly-out-nav__trigger {?Header.hide_search}ml-4{/Header.hide_search} {^Header.hide_main_nav}is-hidden-widescreen{/Header.hide_main_nav}" data-micromodal-trigger="js-fly-out-nav">
{>"ui/icon" icon="burger" class="icon--large" /}
<span class="is-sr-only">{Strings.s.header.open_menu|s}</span>
</button>
{/Header.has_nav_menu}

{>"shared/header-brand" /}
</div>
Expand Down

0 comments on commit 4b6e836

Please sign in to comment.