Skip to content

Commit e9b8885

Browse files
authored
feat(avatar): update to new visual language (#2019)
1 parent 4bd5612 commit e9b8885

File tree

92 files changed

+384
-134
lines changed

Some content is hidden

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

92 files changed

+384
-134
lines changed

.changeset/moody-banks-study.md

Lines changed: 10 additions & 0 deletions

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,17 @@ const getChild = (child?: string): string => {
1616
aria-hidden="true">
1717
S
1818
</div>${srEl}`;
19+
case "indicator":
20+
return `<img
21+
class="s-avatar--image"
22+
src="https://picsum.photos/id/1/48"
23+
alt="team logo"
24+
/>${srEl}
25+
<div
26+
class="s-avatar--indicator s-activity-indicator s-activity-indicator__sm s-activity-indicator__success"
27+
>
28+
<div class="v-visible-sr">Online</div>
29+
</div>`;
1930
default:
2031
return srEl;
2132
}
@@ -29,7 +40,11 @@ describe("avatar", () => {
2940
default: getChild(),
3041
image: getChild("image"),
3142
letter: getChild("letter"),
43+
indicator: getChild("indicator"),
3244
},
45+
excludedTestids: [
46+
/^s-avatar-(?=.*(32|48|64|96|128)).*-indicator.*$/, // s-avatar with indicator and 32 48 64 96 128 sizes not supported
47+
],
3348
tag: "span",
3449
});
3550
});

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

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
.s-avatar {
22
--_av-size: var(--su-static16);
33
--_av-bg: var(--_white-static); // Force a white background color for when we have transparent avatars
4-
--_av-br: var(--br-sm);
54
--_av-fs-letter: calc(var(--su-static12) - var(--su-static1));
65
--_av-scale-badge: 1;
76

@@ -18,14 +17,8 @@
1817

1918
// MODIFIERS
2019
// Sizes
21-
&&__32,
22-
&&__48 {
23-
--_av-br: var(--br-md);
24-
}
25-
2620
&&__96,
2721
&&__128 {
28-
--_av-br: calc(var(--br-lg) + var(--br-sm));
2922
--_av-scale-badge: 3;
3023
}
3124

@@ -49,7 +42,6 @@
4942

5043
&&__64 {
5144
--_av-size: var(--su-static64);
52-
--_av-br: var(--br-lg);
5345
--_av-fs-letter: calc(var(--su-static48) - var(--su-static4));
5446
--_av-scale-badge: 2.4;
5547
}
@@ -74,7 +66,6 @@
7466
}
7567

7668
& &--image {
77-
border-radius: var(--_av-br);
7869
display: block;
7970
height: var(--_av-size);
8071
width: var(--_av-size);
@@ -95,8 +86,15 @@
9586
user-select: none;
9687
}
9788

98-
background-color: var(--_av-bg);
99-
border-radius: var(--_av-br);
89+
& &--indicator {
90+
box-shadow: 0 0 0 var(--su-static2) var(--white);
91+
bottom: 100%;
92+
left: 100%;
93+
position: absolute;
94+
transform: translate(-50%, 60%);
95+
}
96+
97+
background-color: var(--_av-bg);
10098
height: var(--_av-size);
10199
width: var(--_av-size);
102100

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@ const getChild = (child?: string): string => {
2020
aria-hidden="true">
2121
S
2222
</div>${srEl}`;
23+
case "indicator":
24+
return `<img
25+
class="s-avatar--image"
26+
src="${base64Image}"
27+
alt="team logo"
28+
/>${srEl}
29+
<div
30+
class="s-avatar--indicator s-activity-indicator s-activity-indicator__sm s-activity-indicator__success"
31+
>
32+
<div class="v-visible-sr">Online</div>
33+
</div>`;
2334
default:
2435
return srEl;
2536
}
@@ -33,11 +44,15 @@ describe("avatar", () => {
3344
default: getChild(),
3445
image: getChild("image"),
3546
letter: getChild("letter"),
47+
indicator: getChild("indicator"),
3648
},
3749
attributes: {
3850
href: "#",
3951
},
4052
tag: "a",
53+
excludedTestids: [
54+
/^s-avatar-(?=.*(32|48|64|96|128)).*-indicator.*$/, // s-avatar with indicator and 32 48 64 96 128 sizes not supported
55+
],
4156
template: ({ component, testid }) => html`
4257
<div
4358
data-testid="${testid}"
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:2eb3a780b8ee451573fe3abb8640c5c435ad235813e2037609e0928896b0907f
3-
size 3785
2+
oid sha256:2f5336fa7e0eae9ff6861159c45e75df86611438662e737a02c8df876fa2f866
3+
size 3120
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:73d15318ef2fcb2d550297144529593ba1bd631385df8722a487b483f1eb498c
3+
size 1062
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:878fc8f428c86982f7f13e1582fb7a6e016c46af10f2ca613e73abcdfe0f08b0
3-
size 2678
2+
oid sha256:18541c3914b450038a358f88aacfad64c57962ad3da01fa914572b672d92fab9
3+
size 2085
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:83120a2129ad0a996973974bf37923bdd7b4e6fe889faec21a8c0ee1e32da8e0
3-
size 923
2+
oid sha256:e0c32281a6152287cb6e5790a5b203aff44141fd766da3b7dc77dbdccd636c96
3+
size 360
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:83120a2129ad0a996973974bf37923bdd7b4e6fe889faec21a8c0ee1e32da8e0
3-
size 923
2+
oid sha256:e0c32281a6152287cb6e5790a5b203aff44141fd766da3b7dc77dbdccd636c96
3+
size 360
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:f100e21d3f6e4d9f54d090edb6a5dd236dece1ece7c152bbe2f3c5bd7559056c
3+
size 896

0 commit comments

Comments
 (0)