-
Notifications
You must be signed in to change notification settings - Fork 3
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
[FEAT] 프로그래스바 컴포넌트 #58
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 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,29 @@ | ||
import Icon from '@assets/svgs'; | ||
import React from 'react'; | ||
|
||
import * as ProgressBarStyle from './progressBar.css'; | ||
|
||
interface ProgressBarProps { | ||
currentStep: number; | ||
totalSteps: number; | ||
onBackClick: () => void; | ||
} | ||
|
||
const ProgressBar = ({ currentStep, totalSteps, onBackClick }: ProgressBarProps) => { | ||
const progressPercentage = (currentStep / totalSteps) * 100; | ||
|
||
return ( | ||
<div className={ProgressBarStyle.container}> | ||
<button className={ProgressBarStyle.backButton} onClick={onBackClick}> | ||
<Icon.IcnArrowBlackLeft /> | ||
</button> | ||
<div className={ProgressBarStyle.barContainer}> | ||
<div | ||
className={ProgressBarStyle.barStyle} | ||
style={{ width: `${progressPercentage}%` }}></div> | ||
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. 현재 단계의 진행도를 계산해서 퍼센트로 width를 채우는 방식 넘 좋네요! inline스타일을 사용하지 않고 적용할 수 있는 방법이 있는지에 대해서 고민하는 시간을 가져봐도 좋을 것 같아요! 물론 지금 progressPercentage를 통해 inline으로 width를 적용하는 것도 좋은 것 같아요!! |
||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ProgressBar; |
This file contains 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,31 @@ | ||
import theme from '@styles/theme.css'; | ||
import { style } from '@vanilla-extract/css'; | ||
|
||
export const container = style({ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
justifyContent: 'space-between', | ||
alignItems: 'start', | ||
width: '37.5rem', | ||
height: '6.4rem', | ||
paddingTop: '1.2rem', | ||
}); | ||
|
||
export const backButton = style({ | ||
width: '4rem', | ||
height: '4rem', | ||
marginLeft: '1.2rem', | ||
}); | ||
|
||
export const barContainer = style({ | ||
width: '100%', | ||
height: '0.2rem', | ||
backgroundColor: theme.COLORS.gray1, | ||
overflow: 'hidden', | ||
}); | ||
|
||
export const barStyle = style({ | ||
height: '100%', | ||
backgroundColor: theme.COLORS.primary400, | ||
bykbyk0401 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
transition: 'width 0.3s ease-in-out', | ||
}); |
This file contains 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,29 @@ | ||
import ProgressBar from '@components/common/progressBar/ProgressBar'; | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
const meta = { | ||
title: 'Common/ProgressBar', | ||
component: ProgressBar, | ||
bykbyk0401 marked this conversation as resolved.
Show resolved
Hide resolved
bykbyk0401 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
parameters: { | ||
layout: 'centered', | ||
}, | ||
args: { | ||
currentStep: 1, | ||
totalSteps: 4, | ||
onBackClick: () => alert('clicked'), | ||
}, | ||
argTypes: { | ||
currentStep: { | ||
control: { type: 'number', min: 1 }, | ||
}, | ||
totalSteps: { | ||
control: { type: 'number', min: 1 }, | ||
}, | ||
}, | ||
} satisfies Meta<typeof ProgressBar>; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Default: Story = {}; |
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.
컨벤션에서 인라인 스타일은 사용하지 않기로 했으니 recipe를 사용해서 currentStep에 맞게 width를 설정하는 방법은 어떨까요?