Skip to content

Commit

Permalink
Merge pull request #22 from 8princesses/feat/progress-bar
Browse files Browse the repository at this point in the history
✨ progress bar
  • Loading branch information
leeks9653 authored Oct 12, 2023
2 parents 0242f09 + 6b29b9b commit 00b1685
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 6 deletions.
6 changes: 0 additions & 6 deletions src/app/test/page.tsx

This file was deleted.

39 changes: 39 additions & 0 deletions src/components/common/ProgressBar.tsx
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]};
`;
18 changes: 18 additions & 0 deletions src/stories/ProgressBar.stories.tsx
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,
},
};

0 comments on commit 00b1685

Please sign in to comment.