Skip to content

Commit 9de9e96

Browse files
Update mixins to use custom property approach, add note to prefer theme classes
1 parent 763299c commit 9de9e96

File tree

1 file changed

+12
-49
lines changed

1 file changed

+12
-49
lines changed

assets/sass/protocol/includes/mixins/_utils.scss

Lines changed: 12 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -223,61 +223,24 @@
223223
}
224224

225225
// Light color links for dark backgrounds.
226+
// Prefer mzp-t-dark class in markup where possible
226227
@mixin light-links {
227-
a:link {
228-
color: themes.$link-color-inverse;
229-
}
230-
231-
a:visited {
232-
color: themes.$link-color-visited-inverse;
233-
}
234-
235-
a:hover,
236-
a:focus,
237-
a:active {
238-
color: themes.$link-color-hover-inverse;
239-
}
240-
241-
a:visited:hover,
242-
a:visited:focus,
243-
a:visited:active {
244-
color: themes.$link-color-visited-hover-inverse;
245-
}
246-
247-
@supports (--css: variables) {
248-
a:link {
249-
color: var(--link-color-inverse);
250-
}
251-
252-
a:visited {
253-
color: var(--link-color-visited-inverse);
254-
}
255-
256-
a:hover,
257-
a:focus,
258-
a:active {
259-
color: var(--link-color-hover-inverse);
260-
}
261-
262-
a:visited:hover,
263-
a:visited:focus,
264-
a:visited:active {
265-
color: var(--link-color-visited-hover-inverse);
266-
}
228+
a {
229+
--link-color: var(--link-color-inverse);
230+
--link-color-hover: var(--link-color-hover-inverse);
231+
--link-color-visited: var(--link-color-visited-inverse);
232+
--link-color-visited-hover:var(--link-color-visited-hover-inverse);
267233
}
268234
}
269235

270236
// White color links for dark backgrounds, when link colors are undesirable.
237+
// Prefer mzp-t-white-links class in markup where possible
271238
@mixin white-links {
272-
a:link,
273-
a:visited {
274-
color: tokens.$color-white;
275-
276-
&:hover,
277-
&:focus,
278-
&:active {
279-
color: tokens.$color-white;
280-
}
239+
a {
240+
--link-color: #{tokens.$color-white};
241+
--link-color-hover: #{tokens.$color-white};
242+
--link-color-visited: #{tokens.$color-white};
243+
--link-color-visited-hover: #{tokens.$color-white};
281244
}
282245
}
283246

0 commit comments

Comments
 (0)