forked from rebassjs/rebass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDonut.js
46 lines (42 loc) · 919 Bytes
/
Donut.js
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import React from 'react'
import sys from 'system-components'
const DonutBase = props => {
const R = 16 - props.strokeWidth
const C = 2 * Math.PI * R
return (
<svg
{...props}
viewBox='0 0 32 32'
width={props.size || 128}
height={props.size || 128}>
<circle
cx={16}
cy={16}
r={R}
fill='none'
stroke='currentcolor'
strokeWidth={props.strokeWidth}
opacity='0.125'
/>
<circle
cx={16}
cy={16}
r={R}
fill='none'
stroke='currentcolor'
strokeWidth={props.strokeWidth}
strokeDasharray={C}
strokeDashoffset={C - props.value * C}
transform='rotate(-90 16 16)'
/>
</svg>
)
}
export const Donut = sys({
is: DonutBase,
color: 'blue',
strokeWidth: 2,
value: 1
}, 'space', 'color')
Donut.displayName = 'Donut'
export default Donut