1
- import clsx from ' clsx' ;
2
- import React , { ReactNode , useState } from ' react' ;
1
+ import clsx from " clsx" ;
2
+ import React , { ReactNode , useState } from " react" ;
3
3
import "./CircularProgressBar.scss"
4
4
5
5
type TVariant = "clockwise" | "static" | "selectable"
@@ -13,7 +13,7 @@ type TCircularProgressProps = {
13
13
stroke ?: number ;
14
14
warning_limit ?: number ;
15
15
icon ?: ReactNode ;
16
- variant : TVariant ;
16
+ variant ? : TVariant ;
17
17
onSelect ?: ( ) => void ;
18
18
} ;
19
19
@@ -43,8 +43,8 @@ export const CircularProgressBar = ({
43
43
} ;
44
44
45
45
return (
46
- < div className = { clsx ( ' deriv-circular-progress' , className ) } >
47
- < svg height = { radius * 2 } width = { radius * 2 } onClick = { variant === ' selectable' ? handleSelect : undefined } >
46
+ < div className = { clsx ( " deriv-circular-progress" , className ) } >
47
+ < svg height = { radius * 2 } width = { radius * 2 } onClick = { variant === " selectable" ? handleSelect : undefined } >
48
48
{ children && (
49
49
< foreignObject x = "0" y = "0" width = { radius * 2 } height = { radius * 2 } >
50
50
< div className = { clsx ( "deriv-circular-progress__content" ) } >
@@ -53,28 +53,28 @@ export const CircularProgressBar = ({
53
53
</ foreignObject >
54
54
) }
55
55
< circle
56
- className = { clsx ( ' deriv-circular-progress__bar' , {
57
- ' deriv-circular-progress--clockwise' : is_clockwise ,
58
- ' deriv-circular-progress__bar--warning' : progress <= warning_limit && progress > danger_limit ,
59
- ' deriv-circular-progress__bar--danger' : progress <= danger_limit ,
60
- ' deriv-circular-progress__bar--selected' : selected && variant === ' selectable'
56
+ className = { clsx ( " deriv-circular-progress__bar" , {
57
+ " deriv-circular-progress--clockwise" : is_clockwise ,
58
+ " deriv-circular-progress__bar--warning" : progress <= warning_limit && progress > danger_limit ,
59
+ " deriv-circular-progress__bar--danger" : progress <= danger_limit ,
60
+ " deriv-circular-progress__bar--selected" : selected && variant === " selectable"
61
61
} ) }
62
62
cx = { radius }
63
63
cy = { radius }
64
- fill = { variant === ' selectable' && selected ? ' blue' : ' transparent' }
64
+ fill = { variant === " selectable" && selected ? " blue" : " transparent" }
65
65
r = { normalizedRadius }
66
66
strokeDasharray = { `${ circumference } ${ circumference } ` }
67
67
strokeWidth = { stroke }
68
- style = { variant != "clockwise" ? { strokeDashoffset : ' none' } : { strokeDashoffset } }
68
+ style = { variant != "clockwise" ? { strokeDashoffset : " none" } : { strokeDashoffset } }
69
69
/>
70
70
{
71
71
variant != "clockwise" && (
72
72
< circle
73
73
cx = { radius }
74
74
cy = { radius }
75
75
r = { normalizedRadius }
76
- fill = ' none'
77
- stroke = ' #E8EEFC'
76
+ fill = " none"
77
+ stroke = " #E8EEFC"
78
78
strokeDasharray = { `${ circumference } ${ circumference } ` }
79
79
strokeWidth = { stroke }
80
80
style = { { strokeDashoffset : circumference - strokeDashoffset } }
0 commit comments