|
1 | | -@use '@swisspost/design-system-styles/mixins/button'; |
2 | | -@use '@swisspost/design-system-styles/mixins/icons'; |
3 | | -@use '@swisspost/design-system-styles/mixins/utilities'; |
4 | 1 | @use '@swisspost/design-system-styles/mixins/media'; |
5 | | -@use '@swisspost/design-system-styles/functions/tokens'; |
6 | | -@use '@swisspost/design-system-styles/tokens/elements'; |
7 | | -@use '@swisspost/design-system-styles/variables/animation'; |
8 | | -@use '@swisspost/design-system-styles/variables/commons'; |
9 | | -@use '@swisspost/design-system-styles/components/header/mixins' as header-mx; |
10 | | -@use '@swisspost/design-system-styles/variables/elevation'; |
11 | 2 | @use '@swisspost/design-system-styles/variables/color'; |
| 3 | +@use '@swisspost/design-system-styles/variables/elevation'; |
12 | 4 |
|
13 | | -@include icons.custom-property('chevrondown'); |
14 | | - |
15 | | -post-mainnavigation { |
16 | | - // reset links and buttons |
17 | | - post-list-item { |
18 | | - > a { |
19 | | - text-decoration: none; |
20 | | - border-radius: 0; |
21 | | - } |
22 | | - |
23 | | - post-megadropdown-trigger button { |
24 | | - @include button.reset-button; |
25 | | - text-align: start; |
26 | | - } |
27 | | - |
28 | | - > a, |
29 | | - post-megadropdown-trigger button { |
30 | | - flex: 0 0 fit-content; |
31 | | - white-space: nowrap; |
32 | | - display: flex; |
33 | | - align-items: center; |
34 | | - justify-content: space-between; |
35 | | - |
36 | | - &:hover { |
37 | | - color: tokens.get('post-link-hover-fg', elements.$post-link); |
38 | | - } |
| 5 | +:host { |
| 6 | + display: flex; |
| 7 | + user-select: none; |
39 | 8 |
|
40 | | - &:focus-visible { |
41 | | - border-radius: 4px; |
42 | | - z-index: 2; |
43 | | - } |
44 | | - } |
| 9 | + @include media.only(desktop) { |
| 10 | + overflow: hidden; |
45 | 11 | } |
| 12 | +} |
46 | 13 |
|
47 | | - // styles specific to for the mega-dropdown buttons |
48 | | - > button, |
49 | | - post-megadropdown-trigger button { |
50 | | - &::after { |
51 | | - content: ''; |
52 | | - @include icons.mask-image('chevrondown'); |
53 | | - height: 1em; |
54 | | - width: 1em; |
55 | | - |
56 | | - @include media.only(tablet) { |
57 | | - font-size: 1.5rem; |
58 | | - } |
59 | | - |
60 | | - @include media.only(mobile) { |
61 | | - font-size: 1rem; |
62 | | - } |
63 | | - } |
64 | | - |
65 | | - @include utilities.high-contrast-mode() { |
66 | | - border: 1px solid ButtonBorder !important; |
| 14 | +nav { |
| 15 | + scroll-behavior: smooth; |
| 16 | + flex: 1 1 auto; |
67 | 17 |
|
68 | | - &:hover::after, |
69 | | - &[aria-expanded='true']::after { |
70 | | - color: HighlightText; |
71 | | - } |
72 | | - } |
| 18 | + @include media.only(desktop) { |
| 19 | + height: var(--post-main-navigation-height); |
73 | 20 | } |
| 21 | +} |
74 | 22 |
|
75 | | - // desktop styles |
76 | | - post-header:not([data-burger-menu]) > & { |
77 | | - display: flex; |
78 | | - height: var(--post-main-navigation-height, 0); |
79 | | - background: color.$white; |
80 | | - user-select: none; |
81 | | - |
82 | | - nav { |
83 | | - flex: 1 1 auto; |
84 | | - scroll-behavior: smooth; |
85 | | - } |
86 | | - |
87 | | - &.scrollable, |
88 | | - &.scrollable nav { |
89 | | - overflow: hidden; |
90 | | - } |
91 | | - |
92 | | - .scroll-control { |
93 | | - $icon-size: 1rem; |
94 | | - $button-padding: 1rem; |
95 | | - $button-width: $icon-size + 2 * $button-padding; |
96 | | - |
97 | | - z-index: 2; |
98 | | - cursor: pointer; |
99 | | - padding: $button-padding; |
100 | | - background: color.$white; |
101 | | - box-shadow: elevation.$elevation-500; |
102 | | - line-height: 1; |
103 | | - |
104 | | - &.scroll-left { |
105 | | - margin-inline-end: -1 * $button-width; |
106 | | - } |
107 | | - |
108 | | - &.scroll-right { |
109 | | - margin-inline-start: -1 * $button-width; |
110 | | - } |
111 | | - |
112 | | - &.d-none { |
113 | | - display: none; |
114 | | - } |
115 | | - |
116 | | - post-icon { |
117 | | - font-size: $icon-size; |
118 | | - } |
119 | | - } |
120 | | - |
121 | | - post-list > [role='list'] { |
122 | | - flex-direction: row; |
123 | | - max-width: 100vw; |
124 | | - } |
125 | | - |
126 | | - post-list-item { |
127 | | - > a, |
128 | | - > button, |
129 | | - post-megadropdown-trigger button { |
130 | | - position: sticky; |
131 | | - padding-inline: 12px; |
132 | | - height: var(--post-main-navigation-height, 0); |
133 | | - gap: 8px; |
134 | | - font-size: 16px; |
135 | | - |
136 | | - .nav-el-active { |
137 | | - font-weight: 700; |
138 | | - text-align: center; |
139 | | - opacity: 0; |
140 | | - } |
141 | | - |
142 | | - .nav-el-inactive { |
143 | | - position: absolute; |
144 | | - opacity: 1; |
145 | | - text-align: center; |
146 | | - width: 100%; |
147 | | - inset-inline-start: 0; |
148 | | - } |
149 | | - |
150 | | - &.active, |
151 | | - &[aria-current='page']:not(post-megadropdown *), |
152 | | - &[aria-expanded='true'] { |
153 | | - background-color: #050400; |
154 | | - color: #fff; |
155 | | - font-weight: 700; |
156 | | - |
157 | | - .nav-el-active { |
158 | | - opacity: 1; |
159 | | - } |
160 | | - |
161 | | - .nav-el-inactive { |
162 | | - opacity: 0; |
163 | | - } |
164 | | - } |
165 | | - |
166 | | - &:hover { |
167 | | - background-color: #504f4b; |
168 | | - color: #fff; |
169 | | - } |
170 | | - |
171 | | - @include media.max(sm) { |
172 | | - font-size: 14px; |
173 | | - } |
174 | | - } |
175 | | - |
176 | | - // styles specific to for the mega-dropdown buttons |
177 | | - > button, |
178 | | - post-megadropdown-trigger button { |
179 | | - padding-inline-end: 12px; |
180 | | - transition: border-block-end-color animation.$transition-base-timing; |
181 | | - |
182 | | - .nav-el-inactive { |
183 | | - width: calc(100% - 1em - 8px); |
184 | | - } |
185 | | - |
186 | | - &::after { |
187 | | - transition: transform animation.$transition-base-timing; |
188 | | - } |
| 23 | +.scroll-control { |
| 24 | + $icon-size: 1rem; |
| 25 | + $button-padding: 1rem; |
| 26 | + $button-width: $icon-size + 2 * $button-padding; |
189 | 27 |
|
190 | | - &[aria-expanded='true']::after { |
191 | | - transform: rotate(180deg); |
192 | | - } |
193 | | - } |
194 | | - } |
| 28 | + z-index: 1; |
| 29 | + cursor: pointer; |
| 30 | + padding: $button-padding; |
| 31 | + background: color.$white; |
| 32 | + box-shadow: elevation.$elevation-500; |
| 33 | + line-height: 1; |
195 | 34 |
|
196 | | - post-megadropdown { |
197 | | - button:not(:is(post-closebutton *)), |
198 | | - a { |
199 | | - @include header-mx.mobile-header-interactive; |
200 | | - } |
201 | | - } |
| 35 | + &.scroll-left { |
| 36 | + margin-inline-end: -1 * $button-width; |
202 | 37 | } |
203 | 38 |
|
204 | | - // tablet/mobile styles |
205 | | - post-header[data-burger-menu] > & { |
206 | | - nav { |
207 | | - transform: none !important; |
208 | | - } |
209 | | - |
210 | | - .scroll-control { |
211 | | - display: none; |
212 | | - } |
213 | | - |
214 | | - post-list-item { |
215 | | - > a, |
216 | | - > button, |
217 | | - post-megadropdown-trigger button { |
218 | | - @include header-mx.mobile-header-interactive; |
| 39 | + &.scroll-right { |
| 40 | + margin-inline-start: -1 * $button-width; |
| 41 | + } |
219 | 42 |
|
220 | | - .nav-el-inactive { |
221 | | - display: none; |
222 | | - } |
223 | | - } |
224 | | - } |
| 43 | + &.d-none { |
| 44 | + display: none; |
| 45 | + } |
225 | 46 |
|
226 | | - // styles specific to for the mega-dropdown buttons |
227 | | - > button::after, |
228 | | - post-megadropdown-trigger button::after { |
229 | | - transform: rotate(-90deg); |
230 | | - } |
| 47 | + post-icon { |
| 48 | + font-size: $icon-size; |
231 | 49 | } |
232 | 50 | } |
0 commit comments