MCPcopy Create free account
hub / github.com/dailydotdev/apps / ProgressCircle

Function ProgressCircle

packages/shared/src/components/ProgressCircle.tsx:37–102  ·  view source on GitHub ↗
({
  progress = 0,
  size = 40,
  stroke = 5,
  showPercentage = false,
  color = 'brand',
}: ProgressCircleProps)

Source from the content-addressed store, hash-verified

35};
36
37const ProgressCircle = ({
38 progress = 0,
39 size = 40,
40 stroke = 5,
41 showPercentage = false,
42 color = 'brand',
43}: ProgressCircleProps): ReactElement => {
44 const normalizedCompletion = Math.min(100, Math.max(0, progress));
45 const isComplete = normalizedCompletion >= 100;
46 const radius = size / 2 - 3;
47 const circumference = 2 * Math.PI * radius;
48 const strokeDashoffset = circumference * (1 - normalizedCompletion / 100);
49
50 return (
51 <div
52 className="relative inline-flex size-10 items-center justify-center"
53 style={{ width: size, height: size }}
54 >
55 {isComplete ? (
56 <VIcon size={IconSize.Medium} className={colorConfig[color].text} />
57 ) : (
58 <>
59 <svg
60 width={size}
61 height={size}
62 viewBox={`0 0 ${size} ${size}`}
63 fill="none"
64 xmlns="http://www.w3.org/2000/svg"
65 >
66 <circle
67 cx={size / 2}
68 cy={size / 2}
69 r={radius}
70 className="stroke-border-subtlest-tertiary"
71 strokeWidth={stroke}
72 fill="transparent"
73 />
74
75 <circle
76 cx={size / 2}
77 cy={size / 2}
78 r={radius}
79 strokeWidth={stroke}
80 strokeLinecap="round"
81 strokeDasharray={circumference}
82 strokeDashoffset={strokeDashoffset}
83 transform={`rotate(-90 ${size / 2} ${size / 2})`}
84 fill="transparent"
85 className={colorConfig[color].stroke}
86 />
87 </svg>
88 {showPercentage && (
89 <Typography
90 bold
91 color={colorConfig[color].typography}
92 type={TypographyType.Callout}
93 className="absolute leading-none"
94 >

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected