-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathindex.tsx
31 lines (29 loc) · 861 Bytes
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import Styles from './Donut.module.css'
interface IDonutProps {
percent: string
percentRest: string
showPercent: boolean
}
export default function Donut(props: IDonutProps) {
return (
<div className={Styles.donut}>
<svg width="100%" height="100%" viewBox="0 0 40 40">
<circle
cx="20"
cy="20"
r="16"
strokeDasharray={props.percent + ' ' + props.percentRest}
strokeDashoffset="25"
rx="250"></circle>
<g>
<text y="50%" x="50%" transform="translate(0, 2)">
<tspan textAnchor="middle" className={Styles.donutPercent}>
{props.showPercent ? props.percent : '?'}
{props.showPercent && <tspan className={Styles.donutPercentSymbol}>%</tspan>}
</tspan>
</text>
</g>
</svg>
</div>
)
}