-
Notifications
You must be signed in to change notification settings - Fork 0
[FEAT] CreateButton 컴포넌트 구현 #59
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
Changes from all commits
67a8e72
1a9e915
7d56573
cfb0781
8d72a92
bd80b46
65c6a02
343e3bc
a789964
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| import { CreateButton } from "./CreateButton"; | ||
|
|
||
| import type { Meta, StoryObj } from "@storybook/react"; | ||
|
|
||
| const meta = { | ||
| title: "Components/CreateButton", | ||
| component: CreateButton, | ||
| parameters: { | ||
| layout: "centered", | ||
| }, | ||
| argTypes: { | ||
| label: { | ||
| control: "text", | ||
| description: "버튼에 표시될 텍스트", | ||
| table: { | ||
| type: { summary: "string" }, | ||
| }, | ||
| }, | ||
| disabled: { | ||
| control: "boolean", | ||
| description: "버튼 비활성화 여부", | ||
| table: { | ||
| type: { summary: "boolean" }, | ||
| defaultValue: { summary: "false" }, | ||
| }, | ||
| }, | ||
| }, | ||
| } satisfies Meta<typeof CreateButton>; | ||
|
|
||
| export default meta; | ||
| type Story = StoryObj<typeof meta>; | ||
|
|
||
| export const Default: Story = { | ||
| args: { label: "생성하기" }, | ||
| }; | ||
|
|
||
| export const Disabled: Story = { | ||
| args: { label: "생성하기", disabled: true }, | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import { cn } from "@lib"; | ||
|
|
||
| export interface CreateButtonProps { | ||
| label: string; | ||
| disabled?: boolean; | ||
| onClick?: () => void; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. onClick을 꼭 안 넣어도 되게(안 넣어도 에러 안 나게) 해두신 이유가 궁금합니당!
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 질문 감사합니다! 저도 몰라서 찾아봤어요.. 🫰🏻 |
||
| } | ||
|
|
||
| export const CreateButton = ({ | ||
| label, | ||
| disabled = false, | ||
| onClick, | ||
| }: CreateButtonProps) => { | ||
| return ( | ||
| <button | ||
| type="button" | ||
| onClick={onClick} | ||
| disabled={disabled} | ||
| className={cn( | ||
| "typo-headline-b-14 inline-flex items-center justify-center rounded px-3 py-1.5", | ||
| disabled | ||
| ? "bg-timo-gray-500 text-timo-gray-700 cursor-not-allowed" | ||
| : "bg-timo-blue-300 cursor-pointer text-white", | ||
| )} | ||
|
ehye1 marked this conversation as resolved.
|
||
| > | ||
| {label} | ||
| </button> | ||
| ); | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| export { Checkbox } from "./checkbox/Checkbox"; | ||
| export { Color } from "./color/Color"; | ||
| export { Typography } from "./typography/Typography"; | ||
| export { Tag } from "./tag/Tag"; | ||
| export { PriorityIcon } from "./priority-icon/PriorityIcon"; | ||
| export { TodayBadge } from "./badge/today-badge/TodayBadge"; | ||
| export { Checkbox } from "@components/checkbox/Checkbox"; | ||
| export { Color } from "@components/color/Color"; | ||
| export { Typography } from "@components/typography/Typography"; | ||
| export { Tag } from "@components/tag/Tag"; | ||
| export { PriorityIcon } from "@components/priority-icon/PriorityIcon"; | ||
| export { CreateButton } from "@components/button/create-button/CreateButton"; | ||
| export { TodayBadge } from "@components/badge/today-badge/TodayBadge"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
디자인 시스템에 따라 컴포넌트를 구현하다 보니, 같은 버튼 종류의 컴포넌트 같은 경우 Components/Button/CreateButton 이런 식으로 폴더 구조를 한 번 더 가져가는 게 좋을 것 같은 생각이 들었어요!
컴포넌트가 더 많아질 거로 생각돼서, 미리 구조화하면 시각적으로 구분하기도 더 좋을 것 같아요! 스토리북 폴더 구조뿐만 아니라 실제 파일 구조도 한 번 더 구조화해 주시면 감사하겠습니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
그렇네요! 구조화도 신경써야겠네요!!! 👍🏻🫡