Skip to content

Commit ef094db

Browse files
authored
Update avatar styles (#3021)
1 parent 99a8715 commit ef094db

File tree

10 files changed

+53
-19
lines changed

10 files changed

+53
-19
lines changed

.changeset/sweet-cats-press.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@twilio-paste/design-tokens': patch
3+
'@twilio-paste/core': patch
4+
---
5+
6+
[Design Tokens] update the value of colorTextUser for default and dark themes

.changeset/thin-suns-flow.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@twilio-paste/avatar': patch
3+
'@twilio-paste/core': patch
4+
---
5+
6+
[Avatar] Update styles to align with new Paste Twilio theme

packages/paste-core/components/avatar/__tests__/__snapshots__/avatar.test.tsx.snap

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ exports[`Avatar image should render responsive css with an image 1`] = `
1212
width: sizeIcon30;
1313
height: sizeIcon30;
1414
background-color: colorBackgroundUser;
15-
color: colorText;
15+
color: colorTextUser;
1616
border-radius: borderRadiusCircle;
1717
}
1818
@@ -77,8 +77,9 @@ exports[`Avatar intials should render responsive css 1`] = `
7777
flex-shrink: 0;
7878
width: sizeIcon10;
7979
height: sizeIcon10;
80+
box-shadow: shadowBorderUser;
8081
background-color: colorBackgroundUser;
81-
color: colorText;
82+
color: colorTextUser;
8283
border-radius: borderRadiusCircle;
8384
}
8485
@@ -103,7 +104,7 @@ exports[`Avatar intials should render responsive css 1`] = `
103104
font-size: fontSize10;
104105
line-height: lineHeight10;
105106
display: inline-block;
106-
font-weight: fontWeightBold;
107+
font-weight: fontWeightSemibold;
107108
vertical-align: top;
108109
-webkit-text-decoration: none;
109110
text-decoration: none;

packages/paste-core/components/avatar/src/index.tsx

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const AvatarContents: React.FC<AvatarContentProps> = ({name, size = DEFAULT_SIZE
3131
as="abbr"
3232
display="inline-block"
3333
fontSize={computedTokenNames.fontSize}
34-
fontWeight="fontWeightBold"
34+
fontWeight="fontWeightSemibold"
3535
lineHeight={computedTokenNames.lineHeight}
3636
verticalAlign="top"
3737
textDecoration="none"
@@ -48,7 +48,7 @@ AvatarContents.displayName = 'AvatarContents';
4848
const colorVariants: Record<ColorVariants, BoxStyleProps> = {
4949
default: {
5050
backgroundColor: 'colorBackgroundUser',
51-
color: 'colorText',
51+
color: 'colorTextUser',
5252
},
5353
decorative10: {
5454
backgroundColor: 'colorBackgroundDecorative10Weakest',
@@ -77,6 +77,24 @@ const variants: Record<AvatarVariants, BoxStyleProps> = {
7777
},
7878
};
7979

80+
const shadowVariants: Record<ColorVariants, BoxStyleProps> = {
81+
default: {
82+
boxShadow: 'shadowBorderUser',
83+
},
84+
decorative10: {
85+
boxShadow: 'shadowBorderDecorative10Weaker',
86+
},
87+
decorative20: {
88+
boxShadow: 'shadowBorderDecorative20Weaker',
89+
},
90+
decorative30: {
91+
boxShadow: 'shadowBorderDecorative30Weaker',
92+
},
93+
decorative40: {
94+
boxShadow: 'shadowBorderDecorative40Weaker',
95+
},
96+
};
97+
8098
const Avatar = React.forwardRef<HTMLDivElement, AvatarProps>(
8199
(
82100
{name, children, size = DEFAULT_SIZE, element = 'AVATAR', src, icon, color = 'default', variant = 'user', ...props},
@@ -97,6 +115,7 @@ const Avatar = React.forwardRef<HTMLDivElement, AvatarProps>(
97115
flexShrink={0}
98116
ref={ref}
99117
size={size}
118+
{...(src ? undefined : shadowVariants[color])}
100119
{...colorVariants[color]}
101120
{...variants[variant]}
102121
>

packages/paste-design-tokens/__tests__/__snapshots__/index.test.tsx.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ exports[`Design Tokens matches the Dark theme 1`] = `
328328
\\"space-negative-110\\": \\"-2.5rem\\",
329329
\\"color-text-link-destructive-weak\\": \\"rgb(57, 71, 98)\\",
330330
\\"color-text-link-stronger\\": \\"rgb(235, 244, 255)\\",
331-
\\"color-text-user\\": \\"rgb(200, 175, 240)\\",
331+
\\"color-text-user\\": \\"rgb(255, 255, 255)\\",
332332
\\"color-text-icon-new\\": \\"rgb(200, 175, 240)\\",
333333
\\"color-text-icon-offline\\": \\"rgb(244, 244, 246)\\",
334334
\\"color-text-link-destructive\\": \\"rgb(235, 86, 86)\\",
@@ -787,7 +787,7 @@ exports[`Design Tokens matches the Global theme 1`] = `
787787
\\"color-text-link-destructive-dark\\": \\"rgb(173, 17, 17)\\",
788788
\\"color-text-link-destructive-weak\\": \\"rgb(246, 177, 177)\\",
789789
\\"color-text-link-stronger\\": \\"rgb(3, 11, 93)\\",
790-
\\"color-text-user\\": \\"rgb(109, 46, 209)\\",
790+
\\"color-text-user\\": \\"rgb(18, 28, 45)\\",
791791
\\"color-text-icon-new\\": \\"rgb(109, 46, 209)\\",
792792
\\"color-text-icon-offline\\": \\"rgb(96, 107, 133)\\",
793793
\\"color-text-link-destructive\\": \\"rgb(214, 31, 31)\\",
@@ -1178,7 +1178,7 @@ exports[`Design Tokens matches the Sendgrid theme 1`] = `
11781178
\\"space-negative-110\\": \\"-2.5rem\\",
11791179
\\"color-text-link-destructive-weak\\": \\"rgb(246, 177, 177)\\",
11801180
\\"color-text-link-stronger\\": \\"rgb(3, 11, 93)\\",
1181-
\\"color-text-user\\": \\"rgb(109, 46, 209)\\",
1181+
\\"color-text-user\\": \\"rgb(18, 28, 45)\\",
11821182
\\"color-text-icon-new\\": \\"rgb(109, 46, 209)\\",
11831183
\\"color-text-icon-offline\\": \\"rgb(96, 107, 133)\\",
11841184
\\"color-text-link-destructive\\": \\"rgb(214, 31, 31)\\",

packages/paste-design-tokens/tokens/global/text-color.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,5 +508,5 @@ props:
508508

509509
# user
510510
color-text-user:
511-
value: "{!palette-purple-60}"
511+
value: "{!palette-gray-100}"
512512
comment: Text color for user avatar.

packages/paste-design-tokens/tokens/themes/dark/global/text-color.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,5 +183,5 @@ props:
183183

184184
# user
185185
color-text-user:
186-
value: "{!palette-purple-30}"
186+
value: "{!palette-gray-0}"
187187
comment: Text color for user avatar.

packages/paste-design-tokens/tokens/themes/twilio-dark/global/text-color.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,8 @@ props:
3232
- color-background
3333
- color-background-body
3434
- color-background-decorative-40
35+
36+
# user
37+
color-text-user:
38+
value: "{!palette-purple-30}"
39+
comment: Text color for user avatar.

packages/paste-design-tokens/tokens/themes/twilio/global/text-color.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,8 @@ props:
5353
- color-background
5454
- color-background-body
5555
- color-background-decorative-30
56+
57+
# user
58+
color-text-user:
59+
value: "{!palette-purple-60}"
60+
comment: Text color for user avatar.

packages/paste-website/src/pages/components/avatar/index.mdx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -240,15 +240,7 @@ The Avatar `size` can be set as a responsive array of sizes.
240240

241241
The Avatar displays its contents in this priority: image, then icon, then initials.
242242

243-
## Anatomy
244-
245-
| Property | Default token | Modifiable? |
246-
| ---------------- | --------------------- | ----------- |
247-
| border-radius | border-radius-circle | No |
248-
| background-color | color-background-user | No |
249-
| font-weight | font-weight-bold | No |
250-
251-
#### Size Token Mapping
243+
### Size Token Mapping
252244

253245
| Size | Font Size | Line Height | Icon Size |
254246
| ------------- | ------------ | --------------- | ------------ |

0 commit comments

Comments
 (0)