-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] ajoute une declinaison de la navigation pour mobile (pix-15…
…284) #770
- Loading branch information
Showing
12 changed files
with
295 additions
and
84 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,23 @@ | ||
<aside ...attributes class="pix-navigation"> | ||
<header class="pix-navigation__brand">{{yield to="brand"}}</header> | ||
<nav class="pix-navigation__nav" aria-label={{@navigationAriaLabel}}>{{yield | ||
to="navElements" | ||
}}</nav> | ||
<footer class="pix-navigation__footer">{{yield to="footer"}}</footer> | ||
<aside | ||
...attributes | ||
class="pix-navigation {{if this.navigationMenuOpened 'pix-navigation--opened'}}" | ||
> | ||
<header class="pix-navigation__brand">{{yield to="brand"}} | ||
<div class="pix-navigation__burger-menu"><PixButton | ||
aria-controls="{{this.navigationId}} {{this.footerId}}" | ||
aria-expanded={{this.navigationMenuOpened}} | ||
@iconBefore={{if this.navigationMenuOpened "close" "menu"}} | ||
@triggerAction={{this.toggleNavigationMenu}} | ||
>{{@menuLabel}}</PixButton> | ||
</div> | ||
</header> | ||
<nav | ||
class="pix-navigation__nav" | ||
{{on "click" this.handleNavigationClick}} | ||
aria-label={{@navigationAriaLabel}} | ||
id={{this.navigationId}} | ||
> | ||
{{yield to="navElements"}} | ||
</nav> | ||
<footer class="pix-navigation__footer" id={{this.footerId}}>{{yield to="footer"}}</footer> | ||
</aside> |
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,33 @@ | ||
import Component from '@glimmer/component'; | ||
import { action } from '@ember/object'; | ||
import { tracked } from '@glimmer/tracking'; | ||
import { guidFor } from '@ember/object/internals'; | ||
|
||
export default class PixMNavigation extends Component { | ||
constructor(...args) { | ||
super(...args); | ||
this._navigationId = 'navigation-' + guidFor(this); | ||
} | ||
@tracked | ||
navigationMenuOpened = false; | ||
|
||
@action | ||
toggleNavigationMenu() { | ||
this.navigationMenuOpened = !this.navigationMenuOpened; | ||
} | ||
|
||
@action | ||
handleNavigationClick(event) { | ||
if (event.target.nodeName === 'A') { | ||
this.navigationMenuOpened = false; | ||
} | ||
} | ||
|
||
get navigationId() { | ||
return `${this._navigationId}-nav`; | ||
} | ||
|
||
get footerId() { | ||
return `${this._navigationId}-footer`; | ||
} | ||
} |
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
Oops, something went wrong.