Repository navigation
Expand file tree
/
Copy path_links.scss
More file actions
421 lines (367 loc) · 10.7 KB
/
Copy path_links.scss
File metadata and controls
421 lines (367 loc) · 10.7 KB
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
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
////
/// @group helpers/links
////
/// Common link styles
///
/// Provides the typography and focus state, regardless of link style.
///
/// @access public
@mixin govuk-link-common {
@include govuk-typography-common;
@include govuk-link-decoration;
&:hover {
@include govuk-link-hover-decoration;
}
&:focus {
@include govuk-focused-text;
}
}
/// Link decoration
///
/// Provides the text decoration for links, including thickness and underline
/// offset. Use this mixin only if you cannot use the `govuk-link-common` mixin.
///
/// @access public
@mixin govuk-link-decoration {
text-decoration: underline;
@if ($govuk-new-link-styles) {
@if ($govuk-link-underline-thickness) {
text-decoration-thickness: $govuk-link-underline-thickness;
}
@if ($govuk-link-underline-offset) {
text-underline-offset: $govuk-link-underline-offset;
}
}
}
/// Link hover decoration
///
/// Provides the text decoration for links in their hover state, for you to use
/// within a `:hover` pseudo-selector. Use this mixin only if you cannot use the
/// `govuk-link-common` mixin.
///
/// @access public
@mixin govuk-link-hover-decoration {
@if ($govuk-new-link-styles and $govuk-link-hover-underline-thickness) {
text-decoration-thickness: $govuk-link-hover-underline-thickness;
}
}
/// Default link styles
///
/// Makes links use the default unvisited, visited, hover and active colours.
///
/// If you use this mixin in a component, you must also include the
/// `govuk-link-common` mixin to get the correct focus and hover states.
///
/// @example scss
/// .govuk-component__link {
/// @include govuk-link-common;
/// @include govuk-link-style-default;
/// }
///
/// @access public
@mixin govuk-link-style-default {
&:link {
color: $govuk-link-colour;
}
&:visited {
color: $govuk-link-visited-colour;
}
&:hover {
color: $govuk-link-hover-colour;
}
&:active {
color: $govuk-link-active-colour;
}
// When focussed, the text colour needs to be darker to ensure that colour
// contrast is still acceptable
&:focus {
color: $govuk-focus-text-colour;
}
// alphagov/govuk_template includes a specific a:link:focus selector
// designed to make unvisited link s a slightly darker blue when focussed, so
// we need to override the text colour for that combination of selectors so
// so that unvisited links styled as buttons do not end up with dark blue
// text when focussed.
@include govuk-compatibility(govuk_template) {
&:link:focus {
color: $govuk-focus-text-colour;
}
}
}
/// Error link styles
///
/// Makes links use the error colour. The link will darken if it's active or a
/// user hovers their cursor over it.
///
/// If you use this mixin in a component, you must also include the
/// `govuk-link-common` mixin to get the correct focus and hover states.
///
/// @example scss
/// .govuk-component__link {
/// @include govuk-link-common;
/// @include govuk-link-style-error;
/// }
///
/// @access public
@mixin govuk-link-style-error {
&:link,
&:visited {
color: $govuk-error-colour;
}
&:hover {
color: scale-color($govuk-error-colour, $lightness: -30%);
}
&:active {
color: $govuk-error-colour;
}
// When focussed, the text colour needs to be darker to ensure that colour
// contrast is still acceptable
&:focus {
color: $govuk-focus-text-colour;
}
// alphagov/govuk_template includes a specific a:link:focus selector
// designed to make unvisited link s a slightly darker blue when focussed, so
// we need to override the text colour for that combination of selectors so
// so that unvisited links styled as buttons do not end up with dark blue
// text when focussed.
@include govuk-compatibility(govuk_template) {
&:link:focus {
color: $govuk-focus-text-colour;
}
}
}
/// Success link styles
///
/// Makes links use the success colour. The link will darken if it's active or a
/// user hovers their cursor over it.
///
/// If you use this mixin in a component, you must also include the
/// `govuk-link-common` mixin to get the correct focus and hover states.
///
/// @example scss
/// .govuk-component__link {
/// @include govuk-link-common;
/// @include govuk-link-style-success;
/// }
///
/// @access public
@mixin govuk-link-style-success {
&:link,
&:visited {
color: $govuk-success-colour;
}
&:hover {
color: scale-color($govuk-success-colour, $lightness: -30%);
}
&:active {
color: $govuk-success-colour;
}
// When focussed, the text colour needs to be darker to ensure that colour
// contrast is still acceptable
&:focus {
color: $govuk-focus-text-colour;
}
// alphagov/govuk_template includes a specific a:link:focus selector
// designed to make unvisited link s a slightly darker blue when focussed, so
// we need to override the text colour for that combination of selectors so
// so that unvisited links styled as buttons do not end up with dark blue
// text when focussed.
@include govuk-compatibility(govuk_template) {
&:link:focus {
color: $govuk-focus-text-colour;
}
}
}
/// Muted link styles
///
/// Makes links use the secondary text colour. The link will darken if it's
/// active or a user hovers their cursor over it.
///
/// If you use this mixin in a component, you must also include the
/// `govuk-link-common` mixin to get the correct focus and hover states.
///
/// @example scss
/// .govuk-component__link {
/// @include govuk-link-common;
/// @include govuk-link-style-muted;
/// }
///
/// @access public
@mixin govuk-link-style-muted {
&:link,
&:visited {
color: $govuk-secondary-text-colour;
}
&:hover,
&:active {
color: $govuk-text-colour;
}
// When focussed, the text colour needs to be darker to ensure that colour
// contrast is still acceptable
&:focus {
color: $govuk-focus-text-colour;
}
// alphagov/govuk_template includes a specific a:link:focus selector designed
// to make unvisited links a slightly darker blue when focussed, so we need to
// override the text colour for that combination of selectors.
@include govuk-compatibility(govuk_template) {
&:link:focus {
@include govuk-text-colour;
}
}
}
/// Text link styles
///
/// Makes links use the primary text colour, in all states. Use this mixin for
/// navigation components, such as breadcrumbs or the back link.
///
/// If you use this mixin in a component, you must also include the
/// `govuk-link-common` mixin to get the correct focus and hover states.
///
/// @example scss
/// .govuk-component__link {
/// @include govuk-link-common;
/// @include govuk-link-style-text;
/// }
///
/// @access public
@mixin govuk-link-style-text {
&:link,
&:visited {
@include govuk-text-colour;
}
// Force a colour change on hover to work around a bug in Safari
// https://bugs.webkit.org/show_bug.cgi?id=224483
&:hover {
color: rgba($govuk-text-colour, .99);
}
&:active,
&:focus {
@include govuk-text-colour;
}
// alphagov/govuk_template includes a specific a:link:focus selector designed
// to make unvisited links a slightly darker blue when focussed, so we need to
// override the text colour for that combination of selectors.
@include govuk-compatibility(govuk_template) {
&:link:focus {
@include govuk-text-colour;
}
}
}
/// Inverse link styles
///
/// Makes links white, in all states. Use this mixin if you're displaying links
/// against a dark background.
///
/// If you use this mixin in a component, you must also include the
/// `govuk-link-common` mixin to get the correct focus and hover states.
///
/// @example scss
/// .govuk-component__link {
/// @include govuk-link-common;
/// @include govuk-link-style-inverse;
/// }
///
/// @access public
@mixin govuk-link-style-inverse {
&:link,
&:visited {
color: govuk-colour("white");
}
// Force a colour change on hover to work around a bug in Safari
// https://bugs.webkit.org/show_bug.cgi?id=224483
&:hover,
&:active {
color: rgba(govuk-colour("white"), .99);
}
&:focus {
color: $govuk-focus-text-colour;
}
// alphagov/govuk_template includes a specific a:link:focus selector designed
// to make unvisited links a slightly darker blue when focussed, so we need to
// override the text colour for that combination of selectors.
@include govuk-compatibility(govuk_template) {
&:link:focus {
color: $govuk-focus-text-colour;
}
}
}
/// Default link styles, without a visited state
///
/// Makes links use the default unvisited, hover and active colours, with no
/// distinct visited state.
///
/// Use this mixin when it's not helpful to distinguish between visited and
/// non-visited links. For example, when you link to pages with
/// frequently-changing content, such as the dashboard for an admin interface.
///
/// If you use this mixin in a component, you must also include the
/// `govuk-link-common` mixin to get the correct focus and hover states.
///
/// @example scss
/// .govuk-component__link {
/// @include govuk-link-common;
/// @include govuk-link-style-no-visited-state;
/// }
///
/// @access public
@mixin govuk-link-style-no-visited-state {
&:link {
color: $govuk-link-colour;
}
&:visited {
color: $govuk-link-colour;
}
&:hover {
color: $govuk-link-hover-colour;
}
&:active {
color: $govuk-link-active-colour;
}
// When focussed, the text colour needs to be darker to ensure that colour
// contrast is still acceptable
&:focus {
color: $govuk-focus-text-colour;
}
}
/// Remove underline from links
///
/// Remove underlines from links unless the link is active or a user hovers
/// their cursor over it. This has no effect in Internet Explorer 8 (IE8),
/// because IE8 does not support `:not`.
///
/// @example scss
/// .govuk-component__link {
/// @include govuk-link-common;
/// @include govuk-link-style-default;
/// @include govuk-link-style-no-underline;
/// }
///
/// @access public
@mixin govuk-link-style-no-underline {
&:not(:hover):not(:active) {
text-decoration: none;
}
}
/// Include link destination when printing the page
///
/// If the user prints the page, add the destination URL after the link text, if
/// the URL starts with `/`, `http://` or `https://`.
///
/// @access public
@mixin govuk-link-print-friendly {
@include govuk-media-query($media-type: print) {
&[href^="/"],
&[href^="http://"],
&[href^="https://"] {
&:after {
content: " (" attr(href) ")";
font-size: 90%;
// Because the URLs may be very long, ensure that they may be broken
// at arbitrary points if there are no otherwise acceptable break
// points in the line
word-wrap: break-word;
}
}
}
}