@@ -5,49 +5,46 @@ import * as AvatarPrimitive from '@radix-ui/react-avatar'
55
66import { cn } from '@/lib/utils'
77
8- function Avatar ( {
9- className,
10- ...props
11- } : React . ComponentProps < typeof AvatarPrimitive . Root > ) {
12- return (
13- < AvatarPrimitive . Root
14- data-slot = "avatar"
15- className = { cn (
16- 'relative flex size-8 shrink-0 overflow-hidden rounded-full' ,
17- className
18- ) }
19- { ...props }
20- />
21- )
22- }
8+ const Avatar = React . forwardRef <
9+ React . ComponentRef < typeof AvatarPrimitive . Root > ,
10+ React . ComponentPropsWithoutRef < typeof AvatarPrimitive . Root >
11+ > ( ( { className, ...props } , ref ) => (
12+ < AvatarPrimitive . Root
13+ ref = { ref }
14+ className = { cn (
15+ 'relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full' ,
16+ className
17+ ) }
18+ { ...props }
19+ />
20+ ) )
21+ Avatar . displayName = AvatarPrimitive . Root . displayName
2322
24- function AvatarImage ( {
25- className,
26- ...props
27- } : React . ComponentProps < typeof AvatarPrimitive . Image > ) {
28- return (
29- < AvatarPrimitive . Image
30- data-slot = "avatar-image"
31- className = { cn ( 'aspect-square size-full' , className ) }
32- { ...props }
33- />
34- )
35- }
23+ const AvatarImage = React . forwardRef <
24+ React . ComponentRef < typeof AvatarPrimitive . Image > ,
25+ React . ComponentPropsWithoutRef < typeof AvatarPrimitive . Image >
26+ > ( ( { className, ...props } , ref ) => (
27+ < AvatarPrimitive . Image
28+ ref = { ref }
29+ className = { cn ( 'aspect-square h-full w-full' , className ) }
30+ { ...props }
31+ />
32+ ) )
33+ AvatarImage . displayName = AvatarPrimitive . Image . displayName
3634
37- function AvatarFallback ( {
38- className,
39- ...props
40- } : React . ComponentProps < typeof AvatarPrimitive . Fallback > ) {
41- return (
42- < AvatarPrimitive . Fallback
43- data-slot = "avatar-fallback"
44- className = { cn (
45- 'bg-muted flex size-full items-center justify-center rounded-full' ,
46- className
47- ) }
48- { ...props }
49- />
50- )
51- }
35+ const AvatarFallback = React . forwardRef <
36+ React . ComponentRef < typeof AvatarPrimitive . Fallback > ,
37+ React . ComponentPropsWithoutRef < typeof AvatarPrimitive . Fallback >
38+ > ( ( { className, ...props } , ref ) => (
39+ < AvatarPrimitive . Fallback
40+ ref = { ref }
41+ className = { cn (
42+ 'flex h-full w-full items-center justify-center rounded-full bg-muted' ,
43+ className
44+ ) }
45+ { ...props }
46+ />
47+ ) )
48+ AvatarFallback . displayName = AvatarPrimitive . Fallback . displayName
5249
5350export { Avatar , AvatarImage , AvatarFallback }
0 commit comments