Branchwell

AI Resource Pro / portrait-video · airesourcepro.com / src / components / ProgressDots.tsx

1import React from "react";
2
3interface ProgressDotsProps {
4 total: number;
5 current: number;
6 progress: number;
7 color: string;
8}
9
10export const ProgressDots: React.FC<ProgressDotsProps> = ({
11 total,
12 current,
13 progress,
14 color,
15}) => {
16 const safeProgress = Math.max(0, Math.min(1, progress));
17 const ringDegrees = safeProgress * 360;
18
19 return (
20 <div
21 style={{
22 display: "flex",
23 gap: 24,
24 alignItems: "center",
25 }}
26 >
27 {Array.from({ length: total }).map((_, i) => {
28 const isCurrent = i === current;
29 const isPast = i < current;
30
31 return (
32 <div
33 key={i}
34 style={{
35 width: 36,
36 height: 36,
37 borderRadius: "50%",
38 position: "relative",
39 background: isCurrent
40 ? `conic-gradient(${color} ${ringDegrees}deg, rgba(255,255,255,0.2) ${ringDegrees}deg)`
41 : isPast
42 ? color
43 : "rgba(255,255,255,0.18)",
44 border: `2px solid ${isCurrent || isPast ? `${color}cc` : "rgba(255,255,255,0.3)"}`,
45 }}
46 >
47 <div
48 style={{
49 position: "absolute",
50 inset: 5,
51 borderRadius: "50%",
52 backgroundColor: "rgba(10,10,26,0.9)",
53 }}
54 />
55 </div>
56 );
57 })}
58 </div>
59 );
60};