-
Notifications
You must be signed in to change notification settings - Fork 0
[FEAT] AddTaskButton 컴포넌트 구현 #72
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
04e9a01
feat(ui): AddTaskButton 컴포넌트 구현 (#71)
kimminna 125c0ff
feat(web): 전역 button cursor pointer 스타일 적용 (#71)
kimminna 23adee9
style(ui): Tag 컴포넌트 포맷팅 정리 (#71)
kimminna cd0788e
Merge branch 'develop' of https://github.com/Team-Timo/Timo-client in…
kimminna debcb0e
refactor(ui): AddTaskButton import 경로를 alias로 정리 (#71)
kimminna 594661a
refactor(ui): AddTaskButton 텍스트 truncate 로직 단순화 (#71)
kimminna f9ce919
fix(ui): AddTaskButton text prop 필수화 및 하드코딩 카피 제거 (#71)
kimminna c1310db
fix(web): 비활성화된 button cursor 스타일 수정 (#71)
kimminna 405e068
Merge branch 'develop' of https://github.com/Team-Timo/Timo-client in…
kimminna 8d991ef
Merge branch 'develop' of https://github.com/Team-Timo/Timo-client in…
kimminna fd94b4e
refactor(ui): 컴포넌트 export 경로를 절대 경로로 변경 (#71)
kimminna 5bd5af1
chore(root): 컴포넌트 제너레이터가 절대 경로 import를 생성하도록 수정 (#71)
kimminna File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,13 @@ | ||
| @import "tailwindcss"; | ||
| @import "@repo/tailwind-config/theme.css"; | ||
| @import "@repo/timo-design-system/styles"; | ||
|
|
||
| @layer base { | ||
| button { | ||
| cursor: pointer; | ||
| } | ||
|
|
||
| button:disabled { | ||
| cursor: not-allowed; | ||
| } | ||
| } | ||
|
kimminna marked this conversation as resolved.
|
||
44 changes: 44 additions & 0 deletions
44
packages/timo-design-system/src/components/button/add-task-button/AddTaskButton.stories.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| import { AddTaskButton } from "@components/button/add-task-button/AddTaskButton"; | ||
|
|
||
| import type { Meta, StoryObj } from "@storybook/react"; | ||
|
|
||
| const meta = { | ||
| title: "Components/Button/AddTaskButton", | ||
| component: AddTaskButton, | ||
| parameters: { | ||
| layout: "centered", | ||
| }, | ||
| argTypes: { | ||
| text: { | ||
| control: "text", | ||
| }, | ||
| variant: { | ||
| control: "select", | ||
| options: ["default", "weekly", "big"], | ||
| }, | ||
| }, | ||
| } satisfies Meta<typeof AddTaskButton>; | ||
|
|
||
| export default meta; | ||
| type Story = StoryObj<typeof meta>; | ||
|
|
||
| export const Default: Story = { | ||
| args: { | ||
| text: "Add task", | ||
| variant: "default", | ||
| }, | ||
| }; | ||
|
|
||
| export const Weekly: Story = { | ||
| args: { | ||
| text: "Add task", | ||
| variant: "weekly", | ||
| }, | ||
| }; | ||
|
|
||
| export const Big: Story = { | ||
| args: { | ||
| text: "Add task", | ||
| variant: "big", | ||
| }, | ||
| }; |
48 changes: 48 additions & 0 deletions
48
packages/timo-design-system/src/components/button/add-task-button/AddTaskButton.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| import { PlusIcon } from "@icons"; | ||
| import { cn } from "@lib"; | ||
|
|
||
| export type AddTaskButtonVariant = "default" | "weekly" | "big"; | ||
|
kimminna marked this conversation as resolved.
|
||
|
|
||
| const ADD_TASK_BUTTON_VARIANT: Record<AddTaskButtonVariant, string> = { | ||
| default: "w-57.5 px-2 typo-body-m-12", | ||
| weekly: "w-29 px-2 typo-body-m-12", | ||
| big: "h-14.5 w-155 px-5 typo-headline-m-14", | ||
| }; | ||
|
|
||
| export interface AddTaskButtonProps { | ||
| text: string; | ||
| variant?: AddTaskButtonVariant; | ||
| onClick?: () => void; | ||
| } | ||
|
|
||
| export const AddTaskButton = ({ | ||
| text, | ||
| variant = "default", | ||
| onClick, | ||
| }: AddTaskButtonProps) => { | ||
| const isWeekly = variant === "weekly"; | ||
|
|
||
| return ( | ||
| <button | ||
| type="button" | ||
| onClick={onClick} | ||
| className={cn( | ||
| "bg-timo-gray-300 rounded-4 flex items-center gap-1 py-1.5", | ||
| ADD_TASK_BUTTON_VARIANT[variant], | ||
| )} | ||
| > | ||
| <span className="flex size-5.5 shrink-0 items-center justify-center"> | ||
| <PlusIcon /> | ||
| </span> | ||
|
|
||
| <span | ||
| className={cn( | ||
| "text-timo-gray-700", | ||
| isWeekly ? "min-w-0 flex-1 truncate" : "shrink-0 whitespace-nowrap", | ||
| )} | ||
| > | ||
| {text} | ||
| </span> | ||
|
kimminna marked this conversation as resolved.
|
||
| </button> | ||
| ); | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
굿굿!!👍🏻👍🏻
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.
굿굿 👍 👍
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.
굿굿👍♦️