diff --git a/bun.lockb b/bun.lockb index 70b6c60..8b5ec4f 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index ab46e27..402d9cc 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ ] }, "dependencies": { + "@radix-ui/react-avatar": "^1.0.4", "@radix-ui/react-popover": "^1.0.7", "@radix-ui/react-slot": "^1.0.2", "@radix-ui/react-tabs": "^1.0.4", diff --git a/src/components/ui/Avatar/index.stories.tsx b/src/components/ui/Avatar/index.stories.tsx new file mode 100644 index 0000000..a35b165 --- /dev/null +++ b/src/components/ui/Avatar/index.stories.tsx @@ -0,0 +1,24 @@ +import { Avatar, AvatarFallback, AvatarImage } from '.'; + +import type { Meta, StoryObj } from '@storybook/react'; + +const meta: Meta = { + component: Avatar, + parameters: { + layout: 'centered', + }, + tags: ['autodocs'], +}; + +export default meta; + +type Story = StoryObj; + +export const Default: Story = { + render: () => ( + + + CN + + ), +}; diff --git a/src/components/ui/Avatar/index.tsx b/src/components/ui/Avatar/index.tsx new file mode 100644 index 0000000..d3d9c57 --- /dev/null +++ b/src/components/ui/Avatar/index.tsx @@ -0,0 +1,51 @@ +'use client'; + +import * as React from 'react'; + +import * as AvatarPrimitive from '@radix-ui/react-avatar'; + +import { cn } from '@/libs/utils'; + +const Avatar = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)); +Avatar.displayName = AvatarPrimitive.Root.displayName; + +const AvatarImage = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)); +AvatarImage.displayName = AvatarPrimitive.Image.displayName; + +const AvatarFallback = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)); +AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName; + +export { Avatar, AvatarImage, AvatarFallback };