shadcn-vue/apps/www/src/public/registry/styles/new-york/avatar.json
2023-09-08 18:43:17 +08:00

13 lines
1.6 KiB
JSON

{
"name": "avatar",
"dependencies": [
"@radix-ui/react-avatar"
],
"files": [
{
"name": "avatar.tsx",
"content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as AvatarPrimitive from \"@radix-ui/react-avatar\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst Avatar = React.forwardRef<\n React.ElementRef<typeof AvatarPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>\n>(({ class, ...props }, ref) => (\n <AvatarPrimitive.Root\n ref={ref}\n class={cn(\n \"relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full\",\n class\n )}\n {...props}\n />\n))\nAvatar.displayName = AvatarPrimitive.Root.displayName\n\nconst AvatarImage = React.forwardRef<\n React.ElementRef<typeof AvatarPrimitive.Image>,\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>\n>(({ class, ...props }, ref) => (\n <AvatarPrimitive.Image\n ref={ref}\n class={cn(\"aspect-square h-full w-full\", class)}\n {...props}\n />\n))\nAvatarImage.displayName = AvatarPrimitive.Image.displayName\n\nconst AvatarFallback = React.forwardRef<\n React.ElementRef<typeof AvatarPrimitive.Fallback>,\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>\n>(({ class, ...props }, ref) => (\n <AvatarPrimitive.Fallback\n ref={ref}\n class={cn(\n \"flex h-full w-full items-center justify-center rounded-full bg-muted\",\n class\n )}\n {...props}\n />\n))\nAvatarFallback.displayName = AvatarPrimitive.Fallback.displayName\n\nexport { Avatar, AvatarImage, AvatarFallback }\n"
}
],
"type": "components:ui"
}