-
Notifications
You must be signed in to change notification settings - Fork 339
/
Copy path_index.scss
343 lines (288 loc) · 9.18 KB
/
_index.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
@include govuk-exports("govuk/component/header") {
$govuk-header-background: govuk-colour("black");
$govuk-header-border-color: $govuk-brand-colour;
$govuk-header-border-width: govuk-spacing(2);
$govuk-header-text: govuk-colour("white");
$govuk-header-link-active: #1d8feb;
$govuk-header-nav-item-border-color: #2e3133;
$govuk-header-link-underline-thickness: 3px;
$govuk-header-vertical-spacing-value: 2;
// This crown height is only used to calculate top offset of mobile menu button
// as the crown svg height is the only thing that controls the height of the header
$govuk-header-crown-height: 30px;
$govuk-header-menu-button-height: 24px;
$govuk-header-menu-button-width: 80px;
.govuk-header {
@include govuk-font($size: 16, $line-height: 1);
border-bottom: govuk-spacing(2) solid govuk-colour("white");
color: $govuk-header-text;
background: $govuk-header-background;
}
.govuk-header__container--full-width {
padding: 0 govuk-spacing(3);
border-color: $govuk-header-border-color;
.govuk-header__menu-button {
right: govuk-spacing(3);
}
}
.govuk-header__container {
@include govuk-clearfix;
position: relative;
margin-bottom: -$govuk-header-border-width;
padding-top: govuk-spacing($govuk-header-vertical-spacing-value);
border-bottom: $govuk-header-border-width solid $govuk-header-border-color;
}
.govuk-header__logotype {
display: inline-block;
position: relative;
top: -3px;
// Add a gap after the logo in case it's followed by a product name. This
// gets removed later if the logotype is a :last-child.
margin-right: govuk-spacing(1);
fill: currentcolor;
vertical-align: top;
// Prevent readability backplate from obscuring underline in Windows High
// Contrast Mode
@media (forced-colors: active) {
forced-color-adjust: none;
color: linktext;
}
// Remove the gap after the logo if there's no product name to keep hover
// and focus states neat
&:last-child {
margin-right: 0;
}
}
.govuk-header__product-name {
$product-name-offset: if($govuk-new-typography-scale, 7px, 10px);
$product-name-offset-tablet: 5px;
@include govuk-font-size($size: 24, $line-height: 1);
@include govuk-typography-weight-regular;
display: inline-table;
// Maintain space below logo when wrapped
margin-top: $product-name-offset;
// Firefox places the GOV.UK logo one pixel higher, due to how it rounds
// subpixels, so nudge the product name in FF to still be aligned.
@-moz-document url-prefix() {
margin-top: $product-name-offset - 0.5px;
}
// Align vertically with logo when not wrapped
vertical-align: top;
@include govuk-media-query($from: tablet) {
margin-top: $product-name-offset-tablet;
@-moz-document url-prefix() {
margin-top: $product-name-offset-tablet - 0.5px;
}
}
}
.govuk-header__link {
// Avoid using the `govuk-link-common` mixin because the links in the header
// get a special treatment, because:
//
// - underlines are only visible on hover
// - all links get a 3px underline regardless of text size, as there are
// multiple grouped elements close to one another and having slightly
// different underline widths looks unbalanced
@include govuk-link-style-inverse;
text-decoration: none;
&:hover {
text-decoration: underline;
text-decoration-thickness: $govuk-header-link-underline-thickness;
@if $govuk-link-underline-offset {
text-underline-offset: $govuk-link-underline-offset;
}
}
&:focus {
@include govuk-focused-text;
}
}
.govuk-header__link--homepage {
// Font size needs to be set on the link so that the box sizing is correct
// in Firefox
display: inline-block;
margin-right: govuk-spacing(2);
font-size: 30px; // We don't have a mixin that produces 30px font size
@include govuk-media-query($from: desktop) {
display: inline;
&:focus {
// Replicate the focus box shadow but without the -2px y-offset of the first yellow shadow
// This is to stop the logo getting cut off by the box shadow when focused on above a product name
box-shadow: 0 0 $govuk-focus-colour;
}
}
&:link,
&:visited {
text-decoration: none;
}
&:hover,
&:active {
// Negate the added border
margin-bottom: $govuk-header-link-underline-thickness * -1;
border-bottom: $govuk-header-link-underline-thickness solid;
}
// Remove any borders that show when focused and hovered.
&:focus {
margin-bottom: 0;
border-bottom: 0;
}
}
.govuk-header__service-name {
display: inline-block;
margin-bottom: govuk-spacing(2);
@include govuk-font-size($size: 24);
@include govuk-typography-weight-bold;
}
.govuk-header__logo,
.govuk-header__content {
box-sizing: border-box;
}
.govuk-header__logo {
@include govuk-responsive-margin($govuk-header-vertical-spacing-value, "bottom");
// Protect the absolute positioned menu button from overlapping with the
// logo with right padding using the button's width
padding-right: $govuk-header-menu-button-width;
@include govuk-media-query($from: desktop) {
width: 33.33%;
padding-right: $govuk-gutter-half;
float: left;
vertical-align: top;
// Reset float when logo is the last child, without a navigation
&:last-child {
width: auto;
padding-right: 0;
float: none;
}
}
}
.govuk-header__content {
@include govuk-media-query($from: desktop) {
width: 66.66%;
padding-left: $govuk-gutter-half;
float: left;
}
}
.govuk-header__menu-button {
@include govuk-font($size: 16);
position: absolute;
// calculate top offset by:
// - getting the vertical spacing for the top and the bottom of the header
// - adding that to the crown height
// - dividing it by 2 so you have the vertical centre of the header
// - subtracting half the height of the menu button
top: (((govuk-spacing($govuk-header-vertical-spacing-value) * 2) + $govuk-header-crown-height) / 2) -
($govuk-header-menu-button-height / 2);
right: 0;
max-width: $govuk-header-menu-button-width;
min-height: $govuk-header-menu-button-height;
margin: 0;
padding: 0;
border: 0;
color: govuk-colour("white");
background: none;
word-break: break-all;
cursor: pointer;
&:hover {
text-decoration: solid underline $govuk-header-link-underline-thickness;
@if $govuk-link-underline-offset {
text-underline-offset: $govuk-link-underline-offset;
}
}
&:focus {
@include govuk-focused-text;
}
&::after {
@include govuk-shape-arrow($direction: down, $base: 10px, $display: inline-block);
content: "";
margin-left: govuk-spacing(1);
}
&[aria-expanded="true"]::after {
@include govuk-shape-arrow($direction: up, $base: 10px, $display: inline-block);
}
@include govuk-media-query($from: tablet) {
top: govuk-spacing(3);
}
.govuk-frontend-supported & {
display: block;
}
&[hidden],
.govuk-frontend-supported &[hidden] {
display: none;
}
}
.govuk-header__navigation {
@include govuk-media-query($from: desktop) {
margin-bottom: govuk-spacing(2);
}
}
.govuk-header__navigation-list {
// Reset user-agent default list styles
margin: 0;
padding: 0;
list-style: none;
&[hidden] {
display: none;
}
}
.govuk-header__navigation--end {
@include govuk-media-query($from: desktop) {
margin: 0;
padding: govuk-spacing(1) 0;
text-align: right;
}
}
.govuk-header__navigation-item {
padding: govuk-spacing(2) 0;
border-bottom: 1px solid $govuk-header-nav-item-border-color;
@include govuk-media-query($from: desktop) {
display: inline-block;
margin-right: govuk-spacing(3);
padding: govuk-spacing(1) 0;
border: 0;
}
a {
@include govuk-font-size($size: 16);
@include govuk-typography-weight-bold;
white-space: nowrap;
}
}
.govuk-header__navigation-item--active {
a {
&:link,
&:hover,
&:visited {
color: $govuk-header-link-active;
}
// When printing, use the normal blue as this contrasts better with the
// white printing header
@include govuk-media-query($media-type: print) {
color: $govuk-brand-colour;
}
// When focussed, the text colour needs to be darker to ensure that colour
// contrast is still acceptable
&:focus {
color: $govuk-focus-text-colour;
}
}
}
.govuk-header__navigation-item:last-child {
margin-right: 0;
border-bottom: 0;
}
@include govuk-media-query($media-type: print) {
.govuk-header {
border-bottom-width: 0;
color: govuk-colour("black");
background: transparent;
}
.govuk-header__link {
&:link,
&:visited {
color: govuk-colour("black");
}
// Do not append link href to GOV.UK link when printing (e.g. '(/)')
&::after {
display: none;
}
}
}
}