Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IconButton 컴포넌트 스토리 작성 #25

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions src/components/IconButton/IconButton.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import type { Meta, StoryObj } from "@storybook/react";
import {
IoCloseOutline,
IoEllipsisHorizontal,
IoInformation,
} from "react-icons/io5";

import IconButton from ".";

const meta: Meta<typeof IconButton> = {
component: IconButton,
tags: ["autodocs"],
argTypes: {
children: {
control: "inline-radio",
options: ["close", "ellipsis", "information"],
mapping: {
close: <IoCloseOutline />,
ellipsis: <IoEllipsisHorizontal />,
information: <IoInformation />,
},
},
onClick: { action: "clicked" },
},
};

export default meta;
type Story = StoryObj<typeof IconButton>;

export const Basic: Story = {
args: {
children: "close",
},
};
3 changes: 3 additions & 0 deletions src/components/IconButton/IconButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ import * as styles from "./IconButton.css";

export interface IconButtonProps
extends Pick<ButtonHTMLAttributes<HTMLButtonElement>, "onClick"> {
/** IconButton의 className을 설정합니다. className을 통해 스타일을 확장할 수 있습니다. */
className?: string;
/** IconButton안에 들어갈 아이콘 컴포넌트입니다. */
children: ReactNode;
}

/** IconButton는 아이콘만 존재하는 버튼 컴포넌트입니다. */
export default function IconButton({
className = "",
children,
Expand Down
Loading