Skip to content

Commit

Permalink
add documentation to avatar component
Browse files Browse the repository at this point in the history
  • Loading branch information
tnamdevnote committed Jun 12, 2024
1 parent 0b8a973 commit b098903
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions components/atoms/avatar/avatar.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { Meta, StoryObj } from "@storybook/react";
import { Avatar, AvatarImage, AvatarFallback } from "./avatar";

/**
* Avatar component is used to represent a user, and display the profile picture, initials or fallback icon.
*/
const meta: Meta<typeof Avatar> = {
title: "Atoms/Avatar",
component: Avatar,
Expand Down
6 changes: 3 additions & 3 deletions components/atoms/avatar/avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { cva, type VariantProps } from "class-variance-authority";

import { cn } from "@/lib/utils";

const avatarVariatnts = cva(
const avatarVariants = cva(
"relative flex shrink-0 overflow-hidden rounded-full",
{
variants: {
Expand All @@ -24,15 +24,15 @@ const avatarVariatnts = cva(

export interface AvatarProps
extends React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>,
VariantProps<typeof avatarVariatnts> {}
VariantProps<typeof avatarVariants> {}

const Avatar = React.forwardRef<
React.ElementRef<typeof AvatarPrimitive.Root>,
AvatarProps
>(({ className, size, ...props }, ref) => (
<AvatarPrimitive.Root
ref={ref}
className={cn(avatarVariatnts({ size }), className)}
className={cn(avatarVariants({ size }), className)}
{...props}
/>
));
Expand Down

0 comments on commit b098903

Please sign in to comment.