File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,15 +3,16 @@ import { getDefaultStyle } from '../helpers'
33import { BaseProps , DEFAULT_COLOR , DEFAULT_WAI_ARIA_ATTRIBUTE } from '../type'
44
55interface RevolvingDotProps extends BaseProps {
6- radius ?: string | number
6+ radius ?: number
77 secondaryColor ?: string
8+ strokeWidth ?: number
89}
910
1011const RevolvingDot : FunctionComponent < RevolvingDotProps > = ( {
11- height = 100 ,
12- width = 100 ,
13- radius = 6 ,
12+ radius = 45 ,
13+ strokeWidth = 5 ,
1414 color = DEFAULT_COLOR ,
15+ secondaryColor,
1516 ariaLabel = 'revolving-dot-loading' ,
1617 wrapperStyle,
1718 wrapperClass,
@@ -26,36 +27,37 @@ const RevolvingDot: FunctionComponent<RevolvingDotProps> = ({
2627 >
2728 < svg
2829 version = "1.1"
29- width = { width }
30- height = { height }
30+ width = { `calc( ${ radius } * 2.5)` }
31+ height = { `calc( ${ radius } * 2.5)` }
3132 xmlns = "http://www.w3.org/2000/svg"
3233 x = "0px"
3334 y = "0px"
3435 data-testid = "revolving-dot-svg"
3536 >
3637 < circle
3738 fill = "none"
38- stroke = { color }
39- strokeWidth = "4"
40- cx = "50"
41- cy = "50"
42- r = { Number ( ` ${ radius } ` ) + 38 }
39+ stroke = { secondaryColor || color }
40+ strokeWidth = { strokeWidth }
41+ cx = { `calc( ${ radius } * 1.28)` }
42+ cy = { `calc( ${ radius } * 1.28)` }
43+ r = { radius }
4344 style = { { opacity : 0.5 } }
4445 />
4546 < circle
4647 fill = { color }
4748 stroke = { color }
4849 strokeWidth = "3"
49- cx = "8"
50- cy = "54"
51- r = { radius }
50+ cx = { `calc(${ radius } * 1.28)` }
51+ cy = { `calc(${ radius } / 3.5)` }
52+ r = { `calc(${ radius } / 5)` }
53+ style = { { transformOrigin : '50% 50%' } }
5254 >
5355 < animateTransform
5456 attributeName = "transform"
5557 dur = "2s"
5658 type = "rotate"
57- from = "0 50 48 "
58- to = "360 50 52 "
59+ from = "0"
60+ to = "360"
5961 repeatCount = "indefinite"
6062 />
6163 </ circle >
Original file line number Diff line number Diff line change @@ -18,16 +18,17 @@ describe('RevolvingDot Loader', () => {
1818
1919 const svg = screen . getByTestId ( svgTestId )
2020 expect ( svg ) . toBeDefined ( )
21- expect ( svg ) . toHaveAttribute ( 'width' , '100' )
22- expect ( svg ) . toHaveAttribute ( 'height' , '100' )
21+ expect ( svg ) . toHaveAttribute ( 'width' , `calc(45 * 2.5)` )
22+ expect ( svg ) . toHaveAttribute ( 'height' , `calc(45 * 2.5)` )
2323
2424 svg . querySelectorAll ( 'circle' ) . forEach ( ( circle , index ) => {
2525 if ( index === 0 ) {
2626 expect ( circle ) . toHaveAttribute ( 'stroke' , DEFAULT_COLOR )
27+ expect ( circle ) . toHaveAttribute ( 'r' , '45' )
2728 } else if ( index === 1 ) {
2829 expect ( circle ) . toHaveAttribute ( 'stroke' , DEFAULT_COLOR )
2930 expect ( circle ) . toHaveAttribute ( 'fill' , DEFAULT_COLOR )
30- expect ( circle ) . toHaveAttribute ( 'r' , '6' )
31+ expect ( circle ) . toHaveAttribute ( 'r' , `calc(45 / 5)` )
3132 }
3233 } )
3334 } )
You can’t perform that action at this time.
0 commit comments