File tree Expand file tree Collapse file tree 1 file changed +26
-2
lines changed Expand file tree Collapse file tree 1 file changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ import * as AvatarPrimitive from "@radix-ui/react-avatar"
6
6
7
7
import { cn } from "@/lib/utils/cn"
8
8
9
+ import { Image } from "../Image"
10
+
9
11
import { Center } from "./flex"
10
12
import { BaseLink , type LinkProps } from "./Link"
11
13
import { LinkBox , LinkOverlay } from "./link-box"
@@ -162,7 +164,18 @@ const Avatar = React.forwardRef<
162
164
< BaseLink { ...commonLinkProps } > { label } </ BaseLink >
163
165
</ LinkOverlay >
164
166
< AvatarBase size = { size } >
165
- < AvatarImage src = { src } />
167
+ { src ? (
168
+ < Image
169
+ className = "object-fill"
170
+ width = { 64 }
171
+ height = { 64 }
172
+ sizes = "4rem"
173
+ src = { src }
174
+ alt = { name }
175
+ />
176
+ ) : (
177
+ < AvatarImage />
178
+ ) }
166
179
< AvatarFallback > { fallbackInitials } </ AvatarFallback >
167
180
</ AvatarBase >
168
181
</ Center >
@@ -173,7 +186,18 @@ const Avatar = React.forwardRef<
173
186
return (
174
187
< AvatarBase ref = { ref } size = { size } className = { className } asChild >
175
188
< BaseLink title = { dataTest } { ...commonLinkProps } >
176
- < AvatarImage src = { src } />
189
+ { src ? (
190
+ < Image
191
+ className = "object-fill"
192
+ width = { 64 }
193
+ height = { 64 }
194
+ sizes = "4rem"
195
+ src = { src }
196
+ alt = { name }
197
+ />
198
+ ) : (
199
+ < AvatarImage />
200
+ ) }
177
201
< AvatarFallback > { fallbackInitials } </ AvatarFallback >
178
202
</ BaseLink >
179
203
</ AvatarBase >
You can’t perform that action at this time.
0 commit comments