Skip to content

Commit a710c69

Browse files
feat(link): Update link component to SHINE designs (#2164)
* Start link changes * update link * Update link.less * update link svelte component * update svelte component * Update link.less * fix a11y tests * remove block link * fix lint * fix lint * fix lint * update stacks docs to add s-link to bare <a> * Remove s-block-link visual regression images * Revert "update stacks docs to add s-link to bare <a>" This reverts commit f2dcd2f. * Remove visited link modifier * Handle links on a per-component basis * formatting * Tweak colors * Include HC mode nav item underline * Update anchors test files to remove `default` * Update link.less * run format * Update necessary <a> elements to have correct styling * update handle inherits correctly * revert unneeded changes * fix issue where styles were not applied * add changeset and update migration guide * Apply underline to links; minor consolidation * Migration guide tweaks * Fix post summary title link underlining * Update visual regression images * Remove cruft from svelte props * Update dropdown triangle to rely on inline-flex --------- Co-authored-by: Dan Cormier <[email protected]>
1 parent 92cd983 commit a710c69

File tree

226 files changed

+565
-1099
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

226 files changed

+565
-1099
lines changed

.changeset/cute-parts-glow.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
"@stackoverflow/stacks": minor
3+
"@stackoverflow/stacks-svelte": minor
4+
---
5+
6+
Update link component to new SHINE designs
7+
8+
BREAKING CHANGES:
9+
10+
- <a> elements no longer automatically have s-link styling, `s-link` needs to be an explict class of any <a> element that needs the styling
11+
- `block-link` component deleted

MIGRATION_GUIDE.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333

3434
### Components
3535

36+
#### Anchors
37+
- Removed `.s-anchors__default` in favor of appling those styles as the default for `.s-anchors`
38+
3639
#### Badge
3740
- `.s-badge__xs` removed
3841
- `.s-badge__filled` removed
@@ -54,6 +57,9 @@
5457
- The Award Bling component has been renamed to Bling.
5558
- Bling no longer accepts children elements besides those for screen readers. Please include any visually represented strings (such as counts) as siblings to the bling component.
5659

60+
#### Block Link
61+
- The Block Link component has been removed.
62+
5763
#### Buttons
5864
- The secondary style `outlined` has been removed i.e. `.s-btn__outlined`
5965
- The default button style is `filled`, use `.s-btn__clear` to use a clear style of a button
@@ -76,6 +82,10 @@
7682
- `s-label__md`, `s-label__xl` removed
7783
- `s-label--status`, `s-label--status__required`, `s-label--status__new`, `s-label--status__beta` removed. Use the new `s-badge` states instead.
7884

85+
#### Link
86+
- <a> elements no longer automatically have s-link styling, `s-link` needs to be an explict class of any <a> element that needs the styling
87+
- `s-link__visited` Removed
88+
7989
#### Loader
8090
- `Spinner` component replaced with new `Loader` component
8191
- `xs` and `xl` sized have been removed, leaving only the default, `sm`, and `lg` sizes

packages/stacks-classic/lib/components/anchor/anchor.a11y.test.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,7 @@ describe("anchors", () => {
1111
runA11yTests({
1212
baseClass: "s-anchors",
1313
modifiers: {
14-
primary: [
15-
"default",
16-
"grayscale",
17-
"muted",
18-
"danger",
19-
"inherit",
20-
"underlined",
21-
],
14+
primary: ["grayscale", "muted", "danger", "inherit", "underlined"],
2215
},
2316
children: {
2417
default: `A ${link(
@@ -28,8 +21,5 @@ describe("anchors", () => {
2821
false
2922
)}.`,
3023
},
31-
options: {
32-
includeNullModifier: false,
33-
},
3424
});
3525
});
Lines changed: 28 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
.s-anchors {
2-
// CUSTOM PROPERTIED DEFINED WITHIN VARIANTS
3-
// --_an-a-fc
4-
// --_an-a-fc-hover
5-
// --_an-a-fc-visited
6-
// --_an-a-fc-hover-visited
2+
--_an-a-fc: var(--theme-link-color, var(--black-600));
3+
--_an-a-fc-hover: var(--theme-link-color-hover, var(--blue-400));
4+
--_an-a-fc-visited: var(--theme-link-color-visited, var(--black-400));
5+
6+
// CONTEXTUAL STYLES
7+
.highcontrast-mode({
8+
a[href] {
9+
text-decoration: underline;
10+
}
11+
});
712

813
// MODIFIERS
914
&&__underlined {
@@ -14,30 +19,15 @@
1419
}
1520

1621
// VARIANTS
17-
&&__danger,
18-
&&__grayscale,
19-
&&__inherit,
20-
&&__muted {
21-
--_an-a-fc-hover-visited: var(--_an-a-fc-hover);
22-
}
23-
2422
&&__danger {
2523
--_an-a-fc: var(--red-400);
2624
--_an-a-fc-hover: var(--red-500);
2725
--_an-a-fc-visited: var(--red-600);
2826
}
2927

30-
&&__default {
31-
--_an-a-fc: var(--theme-link-color, var(--theme-secondary));
32-
--_an-a-fc-hover: var(--theme-link-color-hover, var(--theme-secondary-500));
33-
--_an-a-fc-visited: var(--theme-link-color-visited, var(--purple-500));
34-
--_an-a-fc-hover-visited: var(--theme-link-color-hover, var(--purple-600));
35-
}
36-
3728
&&__grayscale {
3829
--_an-a-fc: var(--black-500);
3930
--_an-a-fc-hover: var(--black-600);
40-
--_an-a-fc-visited: var(--black-400);
4131
}
4232

4333
&&__inherit {
@@ -55,31 +45,30 @@
5545

5646
&&__muted {
5747
--_an-a-fc: var(--black-400);
58-
--_an-a-fc-hover: var(--black-500);
59-
--_an-a-fc-visited: var(--black-600);
6048
}
6149

62-
&&__danger,
63-
&&__default,
64-
&&__grayscale,
65-
&&__inherit,
66-
&&__muted {
67-
a:not(.s-link),
68-
.s-btn.s-btn__link {
69-
&:active,
70-
&:hover {
71-
color: var(--_an-a-fc-hover);
72-
}
50+
p& > a[href],
51+
p > a[href] {
52+
text-decoration: underline;
53+
}
7354

74-
color: var(--_an-a-fc, inherit);
55+
a:not(.s-link),
56+
.s-btn.s-btn__link {
57+
&:active,
58+
&:hover {
59+
color: var(--_an-a-fc-hover);
60+
text-decoration: underline;
7561
}
7662

77-
a:not(.s-link):visited {
78-
&:hover {
79-
color: var(--_an-a-fc-hover-visited, inherit);
80-
}
63+
color: var(--_an-a-fc, inherit);
64+
text-decoration: none;
65+
}
8166

82-
color: var(--_an-a-fc-visited, inherit);
67+
a:not(.s-link):visited {
68+
&:hover {
69+
color: var(--_an-a-fc-hover, inherit);
8370
}
71+
72+
color: var(--_an-a-fc-visited, inherit);
8473
}
8574
}

packages/stacks-classic/lib/components/anchor/anchor.visual.test.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,7 @@ describe("anchors", () => {
1818
runVisualTests({
1919
baseClass: "s-anchors",
2020
modifiers: {
21-
primary: [
22-
"default",
23-
"grayscale",
24-
"muted",
25-
"danger",
26-
"inherit",
27-
"underlined",
28-
],
21+
primary: ["grayscale", "muted", "danger", "inherit", "underlined"],
2922
},
3023
children: {
3124
// children include nested anchors block to test for appropriate nested styling
@@ -35,9 +28,6 @@ describe("anchors", () => {
3528
<div class="s-card s-anchors s-anchors__muted mt4">Muted: ${links}</div>
3629
`,
3730
},
38-
options: {
39-
includeNullModifier: false,
40-
},
4131
template: ({ component, testid }) => html`
4232
<div data-testid="${testid}" class="s-card ws3 fc-green-500">
4333
${testid}: ${component}

packages/stacks-classic/lib/components/avatar/avatar.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,5 +102,6 @@
102102
background-size: 100%;
103103
display: inline-block; // Make sure the avatar has structure regardless of the element eg. span vs. div
104104
position: relative;
105+
text-decoration: none;
105106
vertical-align: bottom; // Make our avatars play more nicely with text next to it.
106107
}

packages/stacks-classic/lib/components/block-link/block-link.a11y.test.ts

Lines changed: 0 additions & 57 deletions
This file was deleted.

packages/stacks-classic/lib/components/block-link/block-link.less

Lines changed: 0 additions & 82 deletions
This file was deleted.

0 commit comments

Comments
 (0)