@@ -12,7 +12,6 @@ import {
1212 getInitials ,
1313 getSources ,
1414 normalizeAvatarName ,
15- ROUNDED_AVATAR_RADIUS_BY_SIZE ,
1615} from './utils'
1716
1817import styles from './avatar.module.css'
@@ -21,11 +20,6 @@ import type { ObfuscatedClassName } from '../utils/common-types'
2120import type { PolymorphicComponentProps } from '../utils/polymorphism'
2221import type { AvatarImage , AvatarShape , AvatarSize , ImageSources } from './utils'
2322
24- type AvatarStyle = React . CSSProperties & {
25- '--reactist-avatar-size' : string
26- '--reactist-avatar-rounded-radius' : string
27- }
28-
2923/**
3024 * Props for the `Avatar` component.
3125 */
@@ -118,12 +112,12 @@ const AvatarContent = polymorphicComponent<'div', AvatarOwnProps, 'omitClassName
118112 ref = { ref }
119113 className = { classNames (
120114 styles . avatar ,
115+ styles [ `size-${ size } ` ] ,
121116 styles [ `shape-${ shape } ` ] ,
122117 metaColorIndex !== undefined && styles [ `meta-color-${ metaColorIndex } ` ] ,
123118 ! availableImageSources && ! hasInitials && styles . empty ,
124119 exceptionallySetClassName ,
125120 ) }
126- style = { getAvatarStyle ( size ) }
127121 data-testid = { testId }
128122 aria-hidden = { isDecorative || undefined }
129123 display = "inlineFlex"
@@ -190,13 +184,6 @@ const Avatar = polymorphicComponent<'div', AvatarOwnProps, 'omitClassName'>(func
190184 )
191185} )
192186
193- function getAvatarStyle ( size : AvatarSize ) : AvatarStyle {
194- return {
195- '--reactist-avatar-size' : `${ size } px` ,
196- '--reactist-avatar-rounded-radius' : ROUNDED_AVATAR_RADIUS_BY_SIZE [ size ] ,
197- }
198- }
199-
200187function getAbsoluteImageSource ( src : string , image : HTMLImageElement ) {
201188 try {
202189 return new URL ( src , image . ownerDocument . baseURI ) . href
0 commit comments