SurfSense/surfsense_web/components/ui/avatar.tsx

42 lines
1,007 B
TypeScript
Raw Normal View History

2025-07-27 10:05:37 -07:00
"use client";
2025-04-07 23:47:06 -07:00
2025-07-27 10:05:37 -07:00
import * as AvatarPrimitive from "@radix-ui/react-avatar";
2025-07-27 10:41:15 -07:00
import type * as React from "react";
2025-04-07 23:47:06 -07:00
2025-07-27 10:05:37 -07:00
import { cn } from "@/lib/utils";
2025-04-07 23:47:06 -07:00
2025-07-27 10:05:37 -07:00
function Avatar({ className, ...props }: React.ComponentProps<typeof AvatarPrimitive.Root>) {
return (
<AvatarPrimitive.Root
data-slot="avatar"
className={cn("relative flex size-8 shrink-0 overflow-hidden rounded-full", className)}
{...props}
/>
);
2025-04-07 23:47:06 -07:00
}
2025-07-27 10:05:37 -07:00
function AvatarImage({ className, ...props }: React.ComponentProps<typeof AvatarPrimitive.Image>) {
return (
<AvatarPrimitive.Image
data-slot="avatar-image"
className={cn("aspect-square size-full", className)}
{...props}
/>
);
2025-04-07 23:47:06 -07:00
}
function AvatarFallback({
2025-07-27 10:05:37 -07:00
className,
...props
2025-04-07 23:47:06 -07:00
}: React.ComponentProps<typeof AvatarPrimitive.Fallback>) {
2025-07-27 10:05:37 -07:00
return (
<AvatarPrimitive.Fallback
data-slot="avatar-fallback"
className={cn("bg-muted flex size-full items-center justify-center rounded-full", className)}
{...props}
/>
);
2025-04-07 23:47:06 -07:00
}
2025-07-27 10:05:37 -07:00
export { Avatar, AvatarImage, AvatarFallback };