-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_nav-double.scss
89 lines (70 loc) · 2.26 KB
/
_nav-double.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*------------------------------------*\
#Navigation advanced: double level
There are styles for two versions of navigation here:
- A "simple" version, where sub menus expand vertically when opened
on smaller screens.
- A version where sub menus have a visible "back" button to close them
on smaller screens because when open they are absolutely positioned
to cover their parent control.
Make sure to comment out whichever version is not needed in your project.
N.B. aria-expanded attribute is managed by JS
\*------------------------------------*/
/* stylelint-disable no-descending-specificity */
/* (Because the order reflects the DOM order, which Stylelint doesn't understand) */
/* Simple double level nav with vertical expansion */
#js-click-nav-vertical {
[data-trigger="sub-nav"] {
inline-size: 100%;
justify-content: space-between;
}
[data-trigger="sub-nav"][aria-expanded="true"] svg {
transform: scaleY(-1);
}
[data-nav="submenu"] {
@include mq($bp-tab-portrait) {
box-shadow: 0 2px 4px 0 rgba(0 0 0 / 25%);
}
}
}
/* Double level nav with a "back" button in each sub menu */
#js-click-nav-horizontal {
[data-trigger="sub-nav"] {
inline-size: 100%;
justify-content: space-between;
svg {
transform: rotate(-90deg);
@include mq($bp-tab-portrait) {
transform: none;
}
}
&[aria-expanded="true"] svg {
@include mq($bp-tab-portrait) {
transform: scaleY(-1);
}
}
}
[data-nav="submenu"] {
inline-size: 100%;
inset-block-start: 0;
min-block-size: 100%;
position: absolute;
z-index: 5;
@include mq($bp-tab-portrait) {
box-shadow: 0 2px 4px 0 rgba(0 0 0 / 25%);
inline-size: auto;
inset-block-start: auto;
min-block-size: auto;
}
}
[data-button="mobile-back"] {
inline-size: 100%;
justify-content: flex-start;
@include mq($bp-tab-portrait) {
display: none;
}
svg {
transform: rotate(90deg);
}
}
}
/* stylelint-enable no-descending-specificity */