File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6262 background-color : var (--reactist-avatar-meta-fill );
6363}
6464
65+ .empty {
66+ background-color : var (--reactist-avatar-empty-fill );
67+ }
68+
6569.shape-circle {
6670 border-radius : 50% ;
6771}
Original file line number Diff line number Diff line change @@ -101,6 +101,7 @@ function AvatarContent({
101101 const availableImageSources = getAvailableImageSources ( imageSources , failedImageSources )
102102
103103 const initials = getInitials ( name )
104+ const hasInitials = initials !== ''
104105 const label = alt ?? name
105106 const isDecorative = label === ''
106107
@@ -109,10 +110,12 @@ function AvatarContent({
109110 className = { classNames (
110111 styles . avatar ,
111112 styles [ `shape-${ shape } ` ] ,
113+ ! availableImageSources && ! hasInitials && styles . empty ,
112114 exceptionallySetClassName ,
113115 ) }
114116 style = { getAvatarStyle ( size , name ) }
115117 data-testid = { testId }
118+ aria-hidden = { isDecorative || undefined }
116119 display = "inlineFlex"
117120 alignItems = "center"
118121 justifyContent = "center"
@@ -141,7 +144,7 @@ function AvatarContent({
141144 )
142145 } }
143146 />
144- ) : (
147+ ) : hasInitials ? (
145148 < div
146149 className = { styles . initials }
147150 role = { label ? 'img' : undefined }
@@ -150,7 +153,7 @@ function AvatarContent({
150153 >
151154 { initials }
152155 </ div >
153- ) }
156+ ) : null }
154157 </ Box >
155158 )
156159}
You can’t perform that action at this time.
0 commit comments