Skip to content

Commit d23610a

Browse files
committed
Change timer styles
1 parent 95c779c commit d23610a

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

frontend/src/components/Timer/index.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,27 @@ import {
88
type TimerProps = { totalTime: number; timeLeft: number };
99

1010
const Timer: React.FC<CircularProgressProps & TimerProps> = (props) => {
11-
const { totalTime, timeLeft } = props;
11+
const { totalTime, timeLeft, thickness, size } = props;
1212
const percentage = (timeLeft / totalTime) * 100;
13+
const minutes = Math.floor(timeLeft / 60);
14+
const seconds = timeLeft % 60;
15+
const formattedSeconds = String(seconds).padStart(2, "0");
16+
const formattedMinutes = String(minutes).padStart(2, "0");
1317
return (
1418
<Box sx={{ position: "relative", display: "inline-flex" }}>
1519
<CircularProgress
1620
variant="determinate"
17-
size={80}
21+
size={size}
1822
value={100}
19-
sx={(theme) => ({ color: theme.palette.grey[200] })}
23+
sx={{ opacity: 0.4 }}
24+
thickness={thickness}
2025
/>
2126
<CircularProgress
2227
variant="determinate"
23-
disableShrink
2428
value={percentage}
25-
size={80}
29+
size={size}
2630
sx={{ position: "absolute" }}
31+
thickness={thickness}
2732
{...props}
2833
/>
2934
<Box
@@ -38,7 +43,9 @@ const Timer: React.FC<CircularProgressProps & TimerProps> = (props) => {
3843
alignItems: "center",
3944
}}
4045
>
41-
<Typography variant="h6">{timeLeft}</Typography>
46+
<Typography variant="h6">
47+
{formattedMinutes}:{formattedSeconds}
48+
</Typography>
4249
</Box>
4350
</Box>
4451
);

frontend/src/pages/Matching/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,12 @@ const Matching: React.FC = () => {
2323
Finding your practice partner
2424
</Typography>
2525
<img src={matching} style={{ height: 120, width: "auto" }} />
26-
<Timer totalTime={totalTime} timeLeft={timeLeft} thickness={4} />
26+
<Timer
27+
totalTime={totalTime}
28+
timeLeft={timeLeft}
29+
thickness={4.8}
30+
size={120}
31+
/>
2732
</Stack>
2833
</AppMargin>
2934
);

0 commit comments

Comments
 (0)