-
Notifications
You must be signed in to change notification settings - Fork 1
New Accessible Dropdown Nav Bar Component #478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
ac1c68a
60ffbf6
7b49707
1efbe42
bbc67b1
f360128
d0a4703
4b4a912
e048cd4
e9a3f52
a69dd10
0f058ed
e176440
c0c5f0b
f2af2b7
1d2222f
b3e5825
f9f79de
c2658ec
aa1e826
3c77519
a10e8cd
054ebdb
cf7d3b4
1c26012
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
& { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I haven't seen this usage before! What does |
||
.dropdown-nav-menu { | ||
display: none; | ||
|
||
@include media($tablet) { | ||
display: block; | ||
} | ||
|
||
.menu-item { | ||
margin-top: 30px; | ||
cursor: pointer; | ||
font-size: 20px; | ||
text-align: left; | ||
width: inherit; | ||
|
||
@include media($tablet) { | ||
display: inline-block; | ||
margin: 0; | ||
margin-right: 30px; | ||
} | ||
|
||
a { | ||
@include rem(font-size, 20px); | ||
|
||
@include media($tablet) { | ||
@include s-base; | ||
} | ||
} | ||
|
||
/* Show the dropdown menu on hover (except on mobile) or triggered by keyboard/touch */ | ||
&:hover { | ||
.sub-menu { | ||
@include media($tablet) { | ||
display: block; | ||
} | ||
} | ||
} | ||
&.open-submenu { | ||
.sub-menu { | ||
display: block; | ||
} | ||
} | ||
|
||
.menu-item-button { | ||
display: inline-block; | ||
padding: 0 18px; | ||
vertical-align: top; | ||
background: none; | ||
width: auto; | ||
border: none; | ||
|
||
&:after { | ||
content: 'v'; | ||
display: inline-block; | ||
font-size: 20px; | ||
} | ||
|
||
@include media($tablet) { | ||
display: none; | ||
vertical-align: initial; | ||
|
||
&.desktop-visible, | ||
&:focus { | ||
display: inline-block; | ||
} | ||
} | ||
} | ||
} | ||
|
||
.sub-menu { | ||
display: none; | ||
padding: 10px 0 20px; | ||
|
||
@include media($tablet) { | ||
position: absolute; | ||
background-color: $white-base; | ||
padding: 5px 15px; | ||
} | ||
|
||
.menu-item { | ||
padding: 0; | ||
margin-top: 15px; | ||
display: block; | ||
|
||
@include media($tablet) { | ||
padding-bottom: 20px; | ||
} | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
$tablet: new-breakpoint(min-width 0); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
.dropdown-nav-bar.no-mobile { | ||
@import 'dropdown-nav-bar-no-mobile'; | ||
@import 'dropdown-nav-bar-common'; | ||
} | ||
|
||
.dropdown-nav-bar:not(.no-mobile) { | ||
@import 'dropdown-nav-bar-common'; | ||
} | ||
Comment on lines
+1
to
+8
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This allowed me to use the same styles for both implementations and just change the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting! I'll defer to @marchwiany on best practices in using dynamic variables as this is pretty foreign to me. For my own edification, would the following not perform a similarly sequenced import? Maybe in the compilation step the second block is executed before the first? .dropdown-nav-bar.no-mobile {
@import 'dropdown-nav-bar-no-mobile';
}
.dropdown-nav-bar {
@import 'dropdown-nav-bar-common';
} |
||
|
||
#mobile-nav-button { | ||
position: absolute; | ||
top: -9999px; | ||
left: -9999px; | ||
|
||
&:checked { | ||
& ~ .dropdown-nav-bar .dropdown-nav-menu { | ||
top: 0; | ||
position: fixed; | ||
overflow: auto; | ||
display: block; | ||
height: 100%; | ||
width: 100%; | ||
} | ||
|
||
& ~ .mobile-menu { | ||
span:nth-child(1) { | ||
transform: translateY(8px) rotate(45deg); | ||
} | ||
span:nth-child(2) { | ||
opacity: 0; | ||
} | ||
span:nth-child(3) { | ||
transform: translateY(-8px) rotate(-45deg); | ||
} | ||
} | ||
} | ||
} | ||
|
||
.mobile-menu { | ||
position: absolute; | ||
right: 15px; | ||
z-index: 3; | ||
cursor: pointer; | ||
|
||
@include media($tablet) { | ||
display: none; | ||
} | ||
|
||
span { | ||
display: block; | ||
margin: 4px auto; | ||
height: 4px; | ||
width: 25px; | ||
background: #333; | ||
transition: 0.5s; | ||
} | ||
} | ||
Comment on lines
+10
to
+57
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the distinction between these styles and the ones included in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this need to be ported over to the client template as well or will the styles automatically be applied when a user imports the component into their project?