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

Badge 컴포넌트 스토리북 코드 작성 #10

Merged
merged 2 commits into from
Jan 25, 2024
Merged
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
19 changes: 19 additions & 0 deletions src/components/Badge/Badge.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Meta, StoryObj } from "@storybook/react";

import { Badge } from "./Badge";

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

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

export const Variants: Story = {
args: {
variant: "orange",
children: "variants",
},
};
3 changes: 3 additions & 0 deletions src/components/Badge/Badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ import * as styles from "./Badge.css";
export type BadgeVariantType = keyof typeof badgeVariants;

export interface BadgeProps {
/** Badge의 스타일을 결정합니다. */
variant: BadgeVariantType;
/** Badge안에 내용이 들어갑니다. */
children: ReactNode;
}

export const badgeVariantList = objectKeys(badgeVariants);

/** Badge는 빠른 인식을 위해 항목의 상태를 강조하기 위해 사용되는 컴포넌트입니다. */
export function Badge({ variant, children }: BadgeProps) {
const badgeStyle = classnames(
styles.badgeBase,
Expand Down
Loading