2025-02-05 20:38:39 -05:00
|
|
|
import * as AvatarPrimitive from '@rn-primitives/avatar';
|
|
|
|
import * as React from 'react';
|
2025-02-09 20:38:38 -05:00
|
|
|
import { cn } from '@/lib/utils';
|
2025-02-05 20:38:39 -05:00
|
|
|
|
|
|
|
const AvatarPrimitiveRoot = AvatarPrimitive.Root;
|
|
|
|
const AvatarPrimitiveImage = AvatarPrimitive.Image;
|
|
|
|
const AvatarPrimitiveFallback = AvatarPrimitive.Fallback;
|
|
|
|
|
|
|
|
const Avatar = React.forwardRef<AvatarPrimitive.RootRef, AvatarPrimitive.RootProps>(
|
|
|
|
({ className, ...props }, ref) => (
|
|
|
|
<AvatarPrimitiveRoot
|
|
|
|
ref={ref}
|
|
|
|
className={cn('relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full', className)}
|
|
|
|
{...props}
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
);
|
|
|
|
Avatar.displayName = AvatarPrimitiveRoot.displayName;
|
|
|
|
|
|
|
|
const AvatarImage = React.forwardRef<AvatarPrimitive.ImageRef, AvatarPrimitive.ImageProps>(
|
|
|
|
({ className, ...props }, ref) => (
|
|
|
|
<AvatarPrimitiveImage
|
|
|
|
ref={ref}
|
|
|
|
className={cn('aspect-square h-full w-full', className)}
|
|
|
|
{...props}
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
);
|
|
|
|
AvatarImage.displayName = AvatarPrimitiveImage.displayName;
|
|
|
|
|
|
|
|
const AvatarFallback = React.forwardRef<AvatarPrimitive.FallbackRef, AvatarPrimitive.FallbackProps>(
|
|
|
|
({ className, ...props }, ref) => (
|
|
|
|
<AvatarPrimitiveFallback
|
|
|
|
ref={ref}
|
|
|
|
className={cn(
|
|
|
|
'flex h-full w-full items-center justify-center rounded-full bg-muted',
|
|
|
|
className
|
|
|
|
)}
|
|
|
|
{...props}
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
);
|
|
|
|
AvatarFallback.displayName = AvatarPrimitiveFallback.displayName;
|
|
|
|
|
|
|
|
export { Avatar, AvatarFallback, AvatarImage };
|