Skip to content

Commit b12771f

Browse files
Review and fix duplicate link styles
1 parent b88c2fa commit b12771f

File tree

4 files changed

+47
-71
lines changed

4 files changed

+47
-71
lines changed

packages/components/action-link/_index.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,9 @@
7575
width: 24px;
7676
}
7777
}
78+
79+
&:visited .nhsuk-icon__arrow-right-circle,
80+
&:hover .nhsuk-icon__arrow-right-circle {
81+
fill: $color_nhsuk-green;
82+
}
7883
}

packages/components/back-link/_index.scss

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
position: relative;
3131
text-decoration: none;
3232

33-
@include nhsuk-link-style-default;
33+
@include nhsuk-link-style-no-visited-state;
3434
@include nhsuk-font-size(16);
3535

3636
.nhsuk-icon__chevron-left {
@@ -45,22 +45,7 @@
4545
}
4646
}
4747

48-
&:visited {
49-
color: $nhsuk-link-color;
50-
}
51-
5248
&:hover {
53-
color: $nhsuk-link-hover-color;
5449
text-decoration: underline;
55-
56-
.nhsuk-icon__chevron-left {
57-
fill: $nhsuk-link-hover-color;
58-
}
59-
}
60-
61-
&:focus {
62-
.nhsuk-icon__chevron-left {
63-
fill: $nhsuk-focus-text-color;
64-
}
6550
}
6651
}

packages/components/breadcrumb/_index.scss

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -54,19 +54,7 @@
5454
}
5555

5656
.nhsuk-breadcrumb__link {
57-
&:visited {
58-
color: $nhsuk-link-color;
59-
60-
&:hover {
61-
color: $nhsuk-link-hover-color;
62-
}
63-
}
64-
65-
&:focus {
66-
&:hover {
67-
color: $nhsuk-focus-text-color;
68-
}
69-
}
57+
@include nhsuk-link-style-no-visited-state;
7058
}
7159

7260
.nhsuk-breadcrumb__back {
@@ -95,11 +83,9 @@
9583
.nhsuk-breadcrumb__backlink {
9684
text-decoration: none;
9785

98-
&:visited {
99-
color: $nhsuk-link-color;
86+
@include nhsuk-link-style-no-visited-state;
10087

101-
&:hover {
102-
color: $nhsuk-link-hover-color;
103-
}
88+
&:hover {
89+
text-decoration: underline;
10490
}
10591
}

packages/core/tools/_links.scss

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,24 @@
1313
/// @include nhsuk-link-style-default;
1414

1515
@mixin nhsuk-link-style-default {
16-
color: $nhsuk-link-color;
16+
& {
17+
color: $nhsuk-link-color;
18+
19+
.nhsuk-icon {
20+
fill: $nhsuk-link-color;
21+
}
22+
}
1723

1824
&:visited {
1925
color: $nhsuk-link-visited-color;
20-
}
2126

22-
&:hover {
23-
color: $nhsuk-link-hover-color;
24-
text-decoration: none;
27+
.nhsuk-icon {
28+
fill: $nhsuk-link-visited-color;
29+
}
2530
}
2631

32+
@include nhsuk-link-style-hover;
33+
2734
&:focus {
2835
@include nhsuk-focused-text;
2936

@@ -42,6 +49,10 @@
4249

4350
&:active {
4451
color: $nhsuk-link-active-color;
52+
53+
.nhsuk-icon {
54+
fill: $nhsuk-link-active-color;
55+
}
4556
}
4657
}
4758

@@ -53,26 +64,13 @@
5364
/// @include nhsuk-link-style-white;
5465

5566
@mixin nhsuk-link-style-white {
56-
color: $color_nhsuk-white;
57-
58-
&:visited {
59-
color: $color_nhsuk-white;
60-
}
67+
@include nhsuk-link-style-default;
68+
@include nhsuk-link-style-hover;
6169

70+
&,
71+
&:visited,
6272
&:hover {
6373
color: $color_nhsuk-white;
64-
text-decoration: none;
65-
}
66-
67-
&:focus {
68-
color: $nhsuk-focus-text-color;
69-
outline: $nhsuk-focus-width solid transparent;
70-
outline-offset: $nhsuk-focus-width;
71-
text-decoration: none;
72-
}
73-
74-
&:active {
75-
color: $nhsuk-link-active-color;
7674
}
7775
}
7876

@@ -83,7 +81,12 @@
8381

8482
@mixin nhsuk-link-style-hover {
8583
&:hover {
84+
color: $nhsuk-link-hover-color;
8685
text-decoration: none;
86+
87+
.nhsuk-icon {
88+
fill: $nhsuk-link-hover-color;
89+
}
8790
}
8891
}
8992

@@ -106,25 +109,17 @@
106109
/// }
107110

108111
@mixin nhsuk-link-style-no-visited-state {
109-
&:link {
110-
color: $nhsuk-link-color;
111-
}
112+
@include nhsuk-link-style-default;
112113

113114
&:visited {
114115
color: $nhsuk-link-color;
115-
}
116-
117-
&:hover {
118-
color: $nhsuk-link-hover-color;
119-
}
120116

121-
&:active {
122-
color: $nhsuk-link-active-color;
117+
.nhsuk-icon {
118+
fill: $nhsuk-link-color;
119+
}
123120
}
124121

125-
&:focus {
126-
color: $nhsuk-focus-text-color;
127-
}
122+
@include nhsuk-link-style-hover;
128123
}
129124

130125
/// Text link styles
@@ -142,9 +137,13 @@
142137
/// }
143138

144139
@mixin nhsuk-link-style-text {
145-
&:link,
140+
&,
146141
&:visited {
147142
color: $nhsuk-text-color;
143+
144+
.nhsuk-icon {
145+
fill: $nhsuk-text-color;
146+
}
148147
}
149148

150149
// Force a colour change on hover to work around a bug in Safari
@@ -154,7 +153,8 @@
154153
}
155154

156155
&:active,
157-
&:focus {
156+
&:focus,
157+
&:focus:hover {
158158
color: $nhsuk-text-color;
159159
}
160160
}

0 commit comments

Comments
 (0)