File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed
Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -11,11 +11,14 @@ interface UserAvatarProps extends AvatarProps {
1111export function UserAvatar ( { user, ...props } : UserAvatarProps ) {
1212 return (
1313 < Avatar { ...props } >
14- < Avatar . Image alt = "Picture" src = { user . image } />
15- < Avatar . Fallback >
16- < span className = "sr-only" > { user . name } </ span >
17- < Icons . user className = "h-4 w-4" />
18- </ Avatar . Fallback >
14+ { user . image ? (
15+ < Avatar . Image alt = "Picture" src = { user . image } />
16+ ) : (
17+ < Avatar . Fallback >
18+ < span className = "sr-only" > { user . name } </ span >
19+ < Icons . user className = "h-4 w-4" />
20+ </ Avatar . Fallback >
21+ ) }
1922 </ Avatar >
2023 )
2124}
Original file line number Diff line number Diff line change 1+ import Image , { ImageProps } from "next/image"
12import * as AvatarPrimitive from "@radix-ui/react-avatar"
23
34import { cn } from "@/lib/utils"
4- import Image , { ImageProps } from "next/image"
55
66type AvatarProps = AvatarPrimitive . AvatarProps
77
@@ -32,7 +32,7 @@ Avatar.Image = function AvatarImage({
3232 return (
3333 < Image
3434 src = { src }
35- className = { cn ( "" , className ) }
35+ className = { cn ( "object-cover " , className ) }
3636 alt = { alt }
3737 width = { width }
3838 height = { height }
You can’t perform that action at this time.
0 commit comments