Skip to content
Snippets Groups Projects
Unverified Commit d0e10a16 authored by Alexis BENOIT's avatar Alexis BENOIT Committed by GitHub
Browse files

Merge pull request #24 from noesya/design-system/dropdown

Dropdown
parents b87d6394 e344e11a
No related branches found
No related tags found
No related merge requests found
class Dropdown {
constructor (selector) {
this.element = document.querySelector(selector);
this.dropdownButton = this.element.querySelector('button');
this.state = {
isOpened: false
};
this.listen();
}
listen () {
this.dropdownButton.addEventListener('click', () => {
this.toggleDropdown();
});
}
toggleDropdown (open = !this.state.isOpened) {
console.log('lalala')
let classAction;
this.state.isOpened = open;
classAction = this.state.isOpened ? 'add' : 'remove';
this.dropdownButton.setAttribute('aria-expanded', this.state.isOpened);
}
}
export default new Dropdown('.diplomas-select');
import './body.js'; import './body.js';
import './blocks/keyFigures'; import './blocks/keyFigures';
import './blocks/timeline'; import './blocks/timeline';
import './design-system/dropdown';
import './nav/stickyNav'; import './nav/stickyNav';
// import './nav/responsive'; // import './nav/responsive';
import './nav/mainMenu'; import './nav/mainMenu';
...@@ -27,6 +27,7 @@ ul.diplomas ...@@ -27,6 +27,7 @@ ul.diplomas
.dropdown-menu .dropdown-menu
@include inset(100%, 0, auto, auto) @include inset(100%, 0, auto, auto)
background-color: black background-color: black
display: none
position: absolute position: absolute
@include media-breakpoint-down(md) @include media-breakpoint-down(md)
// padding-left: $container-gutter-width // padding-left: $container-gutter-width
...@@ -34,8 +35,8 @@ ul.diplomas ...@@ -34,8 +35,8 @@ ul.diplomas
&, &,
a a
color: white color: white
display: block
a a
display: block
padding: $spacing0 padding: $spacing0
white-space: normal white-space: normal
&:not(:first-child) &:not(:first-child)
...@@ -47,6 +48,23 @@ ul.diplomas ...@@ -47,6 +48,23 @@ ul.diplomas
&:focus &:focus
color: black color: black
button[aria-expanded="true"]
@include icon('caret-top', 'after')
+ .dropdown-menu
display: block
// TODO : style de l'icone
// button::after,
// button[aria-expanded="true"]::after
// display: inline-block
// font-family: Icon
// font-size: .375rem
// font-weight: 400
// line-height: 1
// margin-left: 0.3125rem
// vertical-align: middle
.essential .essential
@include grid(12, false, 0) @include grid(12, false, 0)
flex-wrap: wrap flex-wrap: wrap
...@@ -65,4 +83,4 @@ ul.diplomas ...@@ -65,4 +83,4 @@ ul.diplomas
dd dd
grid-column: 5/13 grid-column: 5/13
@include media-breakpoint-down(md) @include media-breakpoint-down(md)
padding-top: 0 padding-top: 0
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment