-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from 8princesses/feat/progress-bar
✨ progress bar
- Loading branch information
Showing
3 changed files
with
57 additions
and
6 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,39 @@ | ||
"use client"; | ||
|
||
import colors from "@/styles/colors"; | ||
import { FC } from "react"; | ||
import styled from "styled-components"; | ||
|
||
interface ProgressBarProps { | ||
/** | ||
* 총 스텝의 수 | ||
*/ | ||
totalStep: number; | ||
|
||
/** | ||
* 현재 스텝 | ||
*/ | ||
currentStep: number; | ||
} | ||
|
||
const ProgressBar: FC<ProgressBarProps> = ({ totalStep, currentStep }) => { | ||
return ( | ||
<ProgressWrap> | ||
<Progress percent={currentStep === 0 ? 0 : (currentStep / totalStep) * 100} /> | ||
</ProgressWrap> | ||
); | ||
}; | ||
|
||
export default ProgressBar; | ||
|
||
const ProgressWrap = styled.div` | ||
height: 3px; | ||
background-color: ${colors.GRAY[2]}; | ||
overflow: hidden; | ||
`; | ||
|
||
const Progress = styled.div<{ percent: number }>` | ||
translate: -${({ percent }) => 100 - percent}%; | ||
height: 100%; | ||
background-color: ${colors.BLUE[5]}; | ||
`; |
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,18 @@ | ||
import ProgressBar from "@/components/common/ProgressBar"; | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
|
||
const meta = { | ||
title: "Common/ProgressBar", | ||
component: ProgressBar, | ||
tags: ["autodocs"], | ||
} satisfies Meta<typeof ProgressBar>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Primary: Story = { | ||
args: { | ||
totalStep: 5, | ||
currentStep: 4, | ||
}, | ||
}; |