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

LinkButton 컴포넌트 스토리 작성 #27

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
35 changes: 35 additions & 0 deletions src/components/LinkButton/LinkButton.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { Meta, StoryObj } from "@storybook/react";

import LinkButton from "./index";

const meta: Meta<typeof LinkButton> = {
title: "LinkButton",
tags: ["autodocs"],
component: LinkButton,
};

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

export const Variants: Story = {
args: {
variant: "primaryFill",
children: "variants",
},
};

export const FullWidth: Story = {
args: {
variant: "primaryFill",
children: "full width",
full: true,
},
};

export const Disabled: Story = {
args: {
variant: "primaryFill",
children: "disabled",
disabled: true,
},
};
2 changes: 2 additions & 0 deletions src/components/LinkButton/LinkButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ import Button from "../Button";
import { ButtonProps } from "../Button/Button";

export interface LinkButtonProps extends Omit<ButtonProps, "onClick"> {
/** 클릭 시 이동할 경로입니다. */
path: string;
}

/** LinkButton은 클릭 시 주어진 경로로 이동하는 컴포넌트입니다. path를 제외한 매개변수들은 Button 컴포넌트에 전달되는 추가 속성들입니다. */
export function LinkButton({ path, children, ...rest }: LinkButtonProps) {
const router = useRouter();

Expand Down
Loading