11import React , { useState , useCallback , useEffect } from 'react' ;
22
3- import type { Experimental } from '../../types' ;
43import { classNames , variationName } from '../../utilities/css' ;
54import { useI18n } from '../../utilities/i18n' ;
65import { useIsAfterInitialMount } from '../../utilities/use-is-after-initial-mount' ;
76import { Image } from '../Image' ;
87
98import styles from './Avatar.scss' ;
109
11- type Size =
12- | 'extraSmall'
13- | 'small'
14- | 'medium'
15- | 'large'
16- | Experimental < 'xl' | '2xl' > ;
10+ type Size = 'xs' | 'small' | 'medium' | 'large' | 'xl' | '2xl' ;
1711
1812enum Status {
1913 Pending = 'PENDING' ,
@@ -24,12 +18,12 @@ enum Status {
2418export const STYLE_CLASSES = [ 'one' , 'two' , 'three' , 'four' , 'five' ] as const ;
2519
2620const avatarStrokeWidth : { [ S in Size ] : string } = {
27- extraSmall : '3' ,
21+ xs : '3' ,
2822 small : '2.5' ,
2923 medium : '2.5' ,
3024 large : '2.5' ,
31- 'xl-experimental' : '2' ,
32- '2xl-experimental ' : '1.5' ,
25+ xl : '2' ,
26+ '2xl' : '1.5' ,
3327} ;
3428
3529/**
@@ -62,8 +56,6 @@ export interface AvatarProps {
6256 name ?: string ;
6357 /** Initials of person to display */
6458 initials ?: string ;
65- /** Whether the avatar is for a customer */
66- customer ?: boolean ;
6759 /** URL of the avatar image which falls back to initials if the image fails to load */
6860 source ?: string ;
6961 /** Callback fired when the image fails to load */
@@ -77,7 +69,6 @@ export function Avatar({
7769 source,
7870 onError,
7971 initials,
80- customer,
8172 size = 'medium' ,
8273 accessibilityLabel,
8374} : AvatarProps ) {
@@ -122,9 +113,7 @@ export function Avatar({
122113 styles . Avatar ,
123114 size && styles [ variationName ( 'size' , size ) ] ,
124115 hasImage && status === Status . Loaded && styles . imageHasLoaded ,
125- ! customer &&
126- ! source &&
127- styles [ variationName ( 'style' , styleClass ( nameString ) ) ] ,
116+ ! source && styles [ variationName ( 'style' , styleClass ( nameString ) ) ] ,
128117 ) ;
129118
130119 const textClassName = classNames (
@@ -170,21 +159,20 @@ export function Avatar({
170159 </ >
171160 ) ;
172161
173- const avatarBody =
174- customer || ! initials ? (
175- avatarPath
176- ) : (
177- < text
178- className = { textClassName }
179- x = "50%"
180- y = "50%"
181- dy = { verticalOffset }
182- fill = "currentColor"
183- textAnchor = "middle"
184- >
185- { initials }
186- </ text >
187- ) ;
162+ const avatarBody = ! initials ? (
163+ avatarPath
164+ ) : (
165+ < text
166+ className = { textClassName }
167+ x = "50%"
168+ y = "50%"
169+ dy = { verticalOffset }
170+ fill = "currentColor"
171+ textAnchor = "middle"
172+ >
173+ { initials }
174+ </ text >
175+ ) ;
188176
189177 const svgMarkup = hasImage ? null : (
190178 < span className = { styles . Initials } >
0 commit comments