MCPcopy Create free account
hub / github.com/anomalyco/opencode / ProgressCircle

Function ProgressCircle

packages/ui/src/components/progress-circle.tsx:9–64  ·  view source on GitHub ↗
(props: ProgressCircleProps)

Source from the content-addressed store, hash-verified

7}
8
9export function ProgressCircle(props: ProgressCircleProps) {
10 const [split, rest] = splitProps(props, ["percentage", "size", "strokeWidth", "class", "classList"])
11
12 const size = () => split.size || 16
13 const strokeWidth = () => split.strokeWidth || 3
14
15 const viewBoxSize = 16
16 const center = viewBoxSize / 2
17 const radius = () => center - strokeWidth() / 2
18 const circumference = createMemo(() => 2 * Math.PI * radius())
19
20 const offset = createMemo(() => {
21 const clampedPercentage = Math.max(0, Math.min(100, split.percentage || 0))
22 const progress = clampedPercentage / 100
23 return circumference() * (1 - progress)
24 })
25
26 return (
27 <svg
28 {...rest}
29 width={size()}
30 height={size()}
31 viewBox={`0 0 ${viewBoxSize} ${viewBoxSize}`}
32 fill="none"
33 data-component="progress-circle"
34 classList={{
35 ...split.classList,
36 [split.class ?? ""]: !!split.class,
37 }}
38 >
39 <circle
40 cx={center}
41 cy={center}
42 r={radius()}
43 data-slot="progress-circle-background"
44 stroke-width={strokeWidth()}
45 />
46 <circle
47 cx={center}
48 cy={center}
49 r={radius()}
50 data-slot="progress-circle-background-overlay"
51 stroke-width={strokeWidth()}
52 />
53 <circle
54 cx={center}
55 cy={center}
56 r={radius()}
57 data-slot="progress-circle-progress"
58 stroke-width={strokeWidth()}
59 stroke-dasharray={circumference().toString()}
60 stroke-dashoffset={offset()}
61 />
62 </svg>
63 )
64}

Callers

nothing calls this directly

Calls 3

radiusFunction · 0.70
sizeFunction · 0.70
strokeWidthFunction · 0.70

Tested by

no test coverage detected