Skip to content

Commit 3996987

Browse files
authored
[EC-79] feat: 진행률 BAR 컴포넌트 구현 (#62)
1 parent 0657198 commit 3996987

File tree

2 files changed

+93
-0
lines changed

2 files changed

+93
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import React from 'react'
2+
import styles from './ProgressBar.module.css'
3+
4+
export default function ProgressBar({ value, max, startDate, endDate }) {
5+
const formatDate = (dateString) => {
6+
const date = new Date(dateString);
7+
return `${date.getFullYear()}.${date.getMonth() + 1}.${date.getDate()}`;
8+
};
9+
10+
const progressPercentage = (value / max) * 100;
11+
12+
return (
13+
<div className={styles.progressContainer}>
14+
<div className={styles.markerContainer}>
15+
<div
16+
className={styles.progressMarker}
17+
style={{ left: `${progressPercentage}%` }}
18+
>
19+
{value}
20+
</div>
21+
</div>
22+
<div className={styles.progressBar}>
23+
<div
24+
className={styles.progressBarCompleted}
25+
style={{ width: `${progressPercentage}%` }}
26+
>
27+
</div>
28+
</div>
29+
<div className={styles.dateLabels}>
30+
<span className={styles.startDate}>{formatDate(startDate)}</span>
31+
<span className={styles.endDate}>{formatDate(endDate)}</span>
32+
</div>
33+
</div>
34+
);
35+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
.progressContainer {
2+
width: 100%;
3+
margin-bottom: 20px;
4+
}
5+
6+
.markerContainer {
7+
position: relative;
8+
width: 100%;
9+
height: 30px;
10+
margin-bottom: 5px;
11+
}
12+
13+
.progressMarker {
14+
position: absolute;
15+
bottom: 0;
16+
transform: translateX(-50%);
17+
background-color: #fff;
18+
border: 2px solid var(--primary-100);
19+
border-radius: 50%;
20+
width: 30px;
21+
height: 30px;
22+
display: flex;
23+
align-items: center;
24+
justify-content: center;
25+
font-size: 12px;
26+
color: #333;
27+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
28+
}
29+
30+
.progressBar {
31+
width: 100%;
32+
background-color: #eee;
33+
border-radius: 4px;
34+
position: relative;
35+
}
36+
37+
.progressBarCompleted {
38+
height: 20px;
39+
background-image: linear-gradient(to right, var(--primary-100), var(--accent-200));
40+
transition: width 0.5s ease-in-out;
41+
border-radius: 4px;
42+
}
43+
44+
.dateLabels {
45+
display: flex;
46+
justify-content: space-between;
47+
margin-top: 5px;
48+
font-size: 14px;
49+
color: #666;
50+
}
51+
52+
.startDate {
53+
text-align: left;
54+
}
55+
56+
.endDate {
57+
text-align: right;
58+
}

0 commit comments

Comments
 (0)