-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathTextLink.css
116 lines (99 loc) · 2.58 KB
/
TextLink.css
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
/**
* TextLink
*/
:root {
--link-color-default: var(--color-link);
--link-border-color-default: #d7dfeb;
--link-color-hover: #23385a;
--link-color-active: var(--color-text);
--link-color-visited: var(--color-link-visited);
--link-border-color-focus: #3b5f9a;
--link-box-shadow-focus: 0 0 0 3px var(--color-fill-focus);
--link-box-shadow-current: 0 0 0 3px var(--color-fill-focus-current);
}
.root {
color: var(--link-color-default);
position: relative;
outline: 0;
text-decoration: underline;
text-underline-position: under;
text-decoration-color: var(--link-border-color-default);
/* Focus outline */
&::before {
border-radius: var(--radius);
border: 1px solid var(--link-border-color-focus);
inset: 0 -2px;
box-shadow: var(--link-box-shadow-focus);
content: "";
display: none;
position: absolute;
z-index: -1;
}
/* Visited */
&:visited {
color: var(--link-color-visited);
text-decoration-color: var(--link-color-visited);
}
/* Hover */
&:hover {
color: var(--link-color-hover);
text-decoration-color: var(--link-color-hover);
}
/* Active */
&:active {
color: var(--link-color-active);
text-decoration-color: var(--link-color-active);
display: inline;
&::before {
display: none;
}
}
/* Focus */
&:focus {
background-image: none;
display: inline-block;
/* Prevents double underline */
&:not(:hover, :active) {
text-decoration: none;
}
/* Activates focus outline */
&:not(:hover)::before {
display: block;
}
}
}
div[class*="Selected"] {
/**
* :not is the crown prince of pseudo selector specificity.
* That's causing stylelint grief here since it's more
* specific than the things above it, but if we invert the
* hierarchy then we'd have to duplicate most of this code.
* <sigh>.
*/
/* stylelint-disable no-descending-specificity */
& .root {
color: var(--color-link-current);
/* Visited */
&:visited {
color: var(--color-link-current);
text-decoration-color: var(--color-link-current);
}
/* Focus */
&:focus {
/* Activates focus outline */
&:not(:hover)::before {
display: block;
box-shadow: var(--link-box-shadow-current);
border: 1px solid var(--link-box-shadow-current);
}
}
&:hover {
color: var(--link-color-selected);
text-decoration-color: var(--link-color-selected);
}
}
}
div[class*="interactionStyles"]:active .root {
color: var(--color-link-current);
text-decoration-color: var(--color-link-current);
}