-
Notifications
You must be signed in to change notification settings - Fork 0
[FEAT] 프로그레스 바 구현 #130
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
[FEAT] 프로그레스 바 구현 #130
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c55ad94
feat: 프로그레스 바 구현
JangYEhoon00 03f92ff
refactor: 디자인 시스템 색상 적용
JangYEhoon00 feefdd3
refactor: description 추가
JangYEhoon00 a5c8483
style: 런타임값 제외한 나머지 스타일 변경
JangYEhoon00 5694a7a
fix: 참조 배열 변경
JangYEhoon00 93d455a
refactor: tailwindCSS 스타일링 양식으로 변경, 불필요한 래퍼 제거
JangYEhoon00 7b3412b
style: 배경 색상 고정
JangYEhoon00 83b1fc9
fix: 린트에러 제거
JangYEhoon00 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| import type { Meta, StoryObj } from '@storybook/react'; | ||
|
|
||
| import { COLORS } from '@/shared/lib/colors'; | ||
|
|
||
| import { ProgressBar } from './ProgressBar'; | ||
|
|
||
| const meta = { | ||
| title: 'Components/ProgressBar', | ||
| component: ProgressBar, | ||
| tags: ['autodocs'], | ||
| parameters: { | ||
| docs: { | ||
| description: { | ||
| component: 'ProgressBar 컴포넌트는 진행 상황을 시각적으로 표시하는 컴포넌트입니다.', | ||
| }, | ||
| }, | ||
| }, | ||
| } satisfies Meta<typeof ProgressBar>; | ||
|
|
||
| export default meta; | ||
|
|
||
| export const Basic: StoryObj<typeof ProgressBar> = { | ||
| args: { | ||
| percent: 60, | ||
| color: 'pink', | ||
| }, | ||
| argTypes: { | ||
| percent: { control: { type: 'range', min: 0, max: 100, step: 1 } }, | ||
| color: { | ||
| control: { type: 'select' }, | ||
| table: { | ||
| type: { summary: 'Colors' }, | ||
| defaultValue: { summary: 'primary' }, | ||
| }, | ||
| options: Object.keys(COLORS), | ||
| }, | ||
| }, | ||
| render: (args) => <ProgressBar {...args} />, | ||
| }; |
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,32 @@ | ||
| import { COLORS } from '@/shared/lib/colors'; | ||
| import { cn } from '@/shared/lib/core'; | ||
|
|
||
| type Props = { | ||
| /** | ||
| * defined in percentage (0-100). | ||
| */ | ||
| percent: number; | ||
| /** | ||
| * color of the progressbar. | ||
| * @default 'primary' | ||
| */ | ||
| color?: keyof typeof COLORS; | ||
| className?: string; | ||
| }; | ||
|
|
||
| export function ProgressBar({ color = 'primary', percent, className }: Props) { | ||
| const clampedPercent = Math.min(100, Math.max(0, percent)); | ||
| const barColor = COLORS[color]; | ||
|
|
||
| return ( | ||
| <div className={cn('h-2.5 w-[16.5rem] overflow-hidden rounded-full bg-gray-100', className)}> | ||
| <div | ||
| className="h-full rounded-full transition-[width] duration-500 ease-in-out" | ||
| style={{ | ||
| width: `${clampedPercent}%`, | ||
| backgroundColor: barColor, | ||
| }} | ||
| /> | ||
| </div> | ||
| ); | ||
| } | ||
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 @@ | ||
| export { ProgressBar } from './ProgressBar'; |
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.
Uh oh!
There was an error while loading. Please reload this page.