Skip to content

Commit c1443ec

Browse files
feat(user card) - Update User card to new SHINE design (part 1) (#2092)
* Update docs and formatting * half finished docs update * Finish docs and update svelte * Update docs * fix lint and tests * Update gaps * fix lint issue * fix test * fix lint * fix test * lint fix * revert gap changes * fix lint issue * fix spacing * update title * fix * Add large variant * Update user-card.less * fix alignment issues * redo responsive code * Tweak the user card markup + less * Add PPCP and start secondary implementation * clean up PPCP * add position location class * fix secondary * add excerpt class * remove no wrap * Update docs to match new markup * Style and docs adjustments * Add avatars * Update svelte component * fix recognition color issue * improve svelte component * Add icon to large usercard * run format * refactor * fix tests * improve svelte component * Add timestamp subcomponent * fix formatting * Minor updates to recognition * Tweak spacing * Update based on classic changes * Update based on comments * visual tests * Update rep color * Update based on comments * fix small issue * Update user-card.less * Back out empty bling changes * Adjust timestamp spacing/link changes * Update Svelte component based on markup changes * Remove badge markup from default example code * Update migration guide with markup/class changes * Revert "Remove badge markup from default example code" This reverts commit 6bfd3e2. * Remove badge markup from default example code (attempt 2) * Update based on feedback * hardcode icon * Update UserCard.test.ts * fix lint issue * Update postsummary * fix test * fix test * Update UserCard.test.ts * Update UserCard.test.ts * optimise component * change award snippet to blings * Update based on review comments and figma changes * Update based on new subcomponents * Update tests * Nested conditional tests * Update UserCard.test.ts * Update UserCard.test.ts * Update UserCard.test.ts --------- Co-authored-by: Dan Cormier <[email protected]>
1 parent 96224f0 commit c1443ec

File tree

139 files changed

+1999
-1370
lines changed

Some content is hidden

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

139 files changed

+1999
-1370
lines changed

.changeset/beige-cycles-spend.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@stackoverflow/stacks": minor
3+
"@stackoverflow/stacks-svelte": minor
4+
---
5+
6+
Update User card to new SHINE design (part 1)

MIGRATION_GUIDE.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,23 @@ The menu component has been updated to use new class names and structure. The fo
134134
- `s-textarea__md` removed
135135
- `s-textarea__xl` removed
136136

137+
#### User Card
138+
139+
Markup for the User Card has changed significantly. Please refer to the [docs](https://beta.stackoverflow.design/product/components/user-cards) for full guidance. Here are the most notable class changes:
140+
141+
- Some component child classes have been replaced in favor of more generic wrappers. These include:
142+
- `s-user-card--avatar`: The avatar should just include the appropriate `.s-avatar` classes
143+
- `s-user-card--awards`: Awards should be placed within a `li` in a `ul.s-user-card--group` container
144+
- `s-user-card--info`: Replaced with other layout classes as appropriate
145+
- `s-user-card--link`: Previously used to style the username and now handled by `.s-user-card--username`
146+
- `s-user-card--location`: Location should be placed in a `li` in a `ul.s-user-card--group.s-user-card--group__split` container
147+
- `s-user-card--role`: Role should be placed in a `li` in a `ul.s-user-card--group.s-user-card--group__split` container
148+
- `s-user-card--tags`: Tags are no longer included in the user card
149+
- `s-user-card--type`: Replaced with `.s-user-card--recognition`
150+
- `s-user-card__highlighted` removed
151+
- `s-user-card__deleted` removed (expected to return in our next User Card iteration)
152+
- The size modifiers `full`, `small`, and `minimal` have been replaced with `sm` and `lg`
153+
137154
# Migrating from Stacks Svelte v0 to v1
138155

139156
## Breaking changes
Lines changed: 88 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,129 +1,121 @@
11
.s-user-card {
22
--_uc-ai: center;
3-
--_uc-bg: unset;
4-
--_uc-bar: unset;
5-
--_uc-d: grid;
6-
--_uc-fc: unset;
7-
--_uc-g: var(--su4) var(--su8);
8-
--_uc-p: var(--su8);
9-
--_uc-info-ai: unset;
10-
--_uc-info-fd: column;
11-
--_uc-link-fs: var(--fs-caption);
12-
--_uc-link-ws: unset;
13-
--_uc-rep-fc: unset;
14-
--_uc-time-fc: var(--black-400);
15-
--_uc-time-ws: unset;
16-
--_uc-type-fc: var(--theme-primary-400);
17-
18-
// MODIFIERS
19-
&&__deleted {
20-
--_uc-fc: var(--black-400);
21-
}
22-
23-
&&__highlighted {
24-
--_uc-bg: var(--theme-secondary-100);
25-
--_uc-bar: var(--br-md);
26-
--_uc-time-fc: var(--black-500);
27-
--_uc-type-fc: var(--black-500);
28-
}
3+
--_uc-fd: unset;
4+
--_uc-column-gap: var(--su6);
5+
--_uc-group-gap: var(--su4);
6+
--_uc-row-gap: var(--su6);
7+
--_uc-username-fs: unset;
298

309
// VARIANTS
31-
&&__minimal,
32-
&&__small {
33-
--_uc-d: flex;
34-
--_uc-g: var(--su4);
35-
--_uc-p: 0;
36-
--_uc-info-ai: center;
37-
--_uc-info-fd: row;
38-
}
10+
// SIZES
11+
&&__lg {
12+
.s-avatar {
13+
margin-right: var(--su6);
14+
}
3915

40-
&&__full {
41-
--_uc-ai: flex-start;
42-
--_uc-link-fs: var(--fs-body2);
43-
}
16+
.s-user-card--username {
17+
margin-right: var(--su2);
18+
}
4419

45-
&&__minimal {
46-
--_uc-link-ws: nowrap;
47-
--_uc-rep-fc: var(--black-500);
48-
--_uc-time-ws: nowrap;
20+
.s-user-card--group:has(> .s-user-card--rep) {
21+
margin-top: calc(var(--su2) * -1);
22+
}
23+
24+
--_uc-ai: flex-start;
25+
--_uc-fd: column;
26+
--_uc-username-fs: var(--fs-body3);
4927
}
5028

5129
// CHILD ELEMENTS
52-
& &--location,
53-
& &--role {
54-
font-size: var(--fs-caption);
30+
& &--bio {
31+
.truncation(3);
5532
color: var(--black-400);
5633
}
5734

58-
& &--awards {
59-
li {
60-
font-size: var(--fs-caption);
61-
}
35+
& &--recognition {
36+
--_uc-row-gap: var(--su4);
6237

63-
.list-reset;
64-
align-items: center;
65-
display: flex;
66-
gap: var(--su6);
38+
&,
39+
& a {
40+
color: var(--theme-primary);
41+
}
6742
}
6843

69-
& &--info {
70-
align-items: var(--_uc-info-ai);
71-
flex-direction: var(--_uc-info-fd);
72-
73-
display: flex;
74-
gap: var(--su4);
44+
& &--rep {
45+
color: var(--black-600);
46+
font-weight: 600;
7547
}
7648

77-
& &--link {
78-
font-size: var(--_uc-link-fs);
79-
white-space: var(--_uc-link-ws);
49+
& &--time {
50+
color: var(--black-400);
51+
}
8052

81-
align-items: center;
82-
flex-wrap: wrap;
83-
min-width: 0; // Allow things to wrap
53+
& &--username {
54+
font-size: var(--_uc-username-fs);
55+
font-weight: 500;
56+
min-width: 0;
8457
overflow-wrap: break-word;
58+
word-break: break-all;
8559
}
8660

87-
& &--rep {
88-
color: var(--_uc-rep-fc);
89-
90-
font-weight: 700;
61+
// Layout specific
62+
& &--column {
63+
align-items: flex-start;
64+
display: flex;
65+
flex-direction: column;
66+
gap: var(--_uc-column-gap);
9167
}
9268

93-
& &--tags {
94-
align-items: center;
95-
min-width: 0; // Allow things to wrap
96-
flex-wrap: wrap;
97-
}
69+
& &--group {
70+
&:has(> .s-avatar) {
71+
--_uc-group-gap: var(--su6);
72+
}
9873

99-
& &--time {
100-
color: var(--_uc-time-fc);
101-
white-space: var(--_uc-time-ws);
74+
&:has(+ .s-user-card--time) {
75+
margin-right: var(--su2);
76+
}
10277

103-
font-size: var(--fs-caption);
104-
grid-column: ~"1 / 3";
105-
grid-row: ~"1 / 2";
78+
align-items: center;
79+
display: flex;
80+
gap: var(--_uc-group-gap);
10681
}
10782

108-
& &--type {
109-
a:not(.s-link) {
110-
color: inherit !important;
83+
& ul&--group {
84+
&.s-user-card--group__split {
85+
li:not(:last-child) {
86+
&:after {
87+
background-color: var(--black-350);
88+
content: "";
89+
display: block;
90+
margin-left: var(--su4);
91+
width: var(--su4);
92+
height: var(--su4);
93+
}
94+
}
11195
}
11296

113-
color: var(--_uc-type-fc);
97+
li {
98+
align-items: center;
99+
display: inline-flex;
100+
gap: var(--su2);
101+
}
114102

115-
font-size: var(--fs-caption);
116-
grid-column: ~"1 / 3";
103+
.list-reset;
104+
}
105+
106+
& &--row {
107+
align-items: center;
108+
display: flex;
109+
flex-direction: row;
110+
flex-wrap: wrap;
111+
gap: var(--_uc-row-gap);
117112
}
118113

119114
align-items: var(--_uc-ai);
120-
background-color: var(--_uc-bg);
121-
border-radius: var(--_uc-bar);
122-
color: var(--_uc-fc);
123-
display: var(--_uc-d);
124-
gap: var(--_uc-g);
125-
126-
grid-template-columns: auto 1fr;
127-
line-height: 1;
128-
padding: var(--_uc-p);
129-
}
115+
color: var(--black-500);
116+
display: flex;
117+
flex-direction: var(--_uc-fd);
118+
flex-wrap: wrap;
119+
font-size: var(--fs-caption);
120+
gap: var(--su6);
121+
}
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:2336d28eb7be927f2857691a3d3ac217ddd6cd8c797947b368a9f87f99ccbb01
3-
size 11111
2+
oid sha256:d67b9592916220c9bf840b8cb11943662f4a3d45c03c5e8422c903bc4e5e473e
3+
size 11378
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:c0e85f3f4b5ee89b308b56f89fcabdedd5c49a19d8aa60ecaa63ab1ace5043c0
3-
size 28641
2+
oid sha256:0951f218423146cca83d70f1c54d9ba127121b8feac759d5fb238b5dca3c0745
3+
size 28971
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:5a9538e9dcf6f48c5eb199942efd2a731bedde3ccef88ee2102a2ad76250de30
3-
size 10799
2+
oid sha256:028a8a699f78306dc672f66a08ddaefce89878f0e896547956f5f9cf7ddc55e6
3+
size 11026
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:71466355e3f7a87c7f176e4f30b944eaf2a3bdbf88d474dae2b53c907f7cffde
3-
size 27788
2+
oid sha256:d4637dfd8dc26be0cb352a075aeb54e98c907d433a0c3fb7866a8242d6952c21
3+
size 28109
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:007925370bc44c1d41b8553ebb6af24245ae49df5cf0fbdbdab614c4dc41ebec
3-
size 38958
2+
oid sha256:a5697c54b58fa1cced87e9ecddaac0e4e2dd1f988d1af0098001faefddb0e92c
3+
size 38904
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:c5d7bcf1a1e3be2d2f1577e6feed2c3ba7efce1c7d25f16d1400a7d877ad6a72
3-
size 33717
2+
oid sha256:850c809eb2a245aa484db4d77a9b7b9231c413ba509dec26ec85f6c44ce85c37
3+
size 33664
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:cc5d631d32140e0a8e11599e804c500ef6c6534281cc367c973445b93c15c3f6
3-
size 22250
2+
oid sha256:6b94e3b8ee8b9980f7be62d593ffe1c7c2a2b8dddf96e95f18892987354219c3
3+
size 22527

0 commit comments

Comments
 (0)