@@ -6,7 +6,7 @@ import styled, {keyframes, IStyledComponent} from 'styled-components';
66
77import { BaseComponentProps } from '../types' ;
88
9- const animationName = keyframes `
9+ const spin = keyframes `
1010 0% {
1111 transform: rotate(0deg);
1212 }
@@ -15,18 +15,15 @@ const animationName = keyframes`
1515 }
1616` ;
1717
18- const Loader = styled . span `
19- border-left-color: ${ props => props . color || props . theme . primaryBtnBgd } ;
20- animation: _preloader_spin_ 500ms linear infinite;
21- border-radius: 50%;
22- border-top-color: transparent;
23- border-bottom-color: transparent;
24- border-right-color: transparent;
25- cursor: wait;
26- border-style: solid;
27- display: block;
28- animation-name: ${ animationName } ;
29- }` ;
18+ const Loader = styled . div `
19+ border: 2px solid ${ props => props . theme . borderColorLT || '#e0e0e0' } ;
20+ border-top: 2px solid ${ props => props . color || props . theme . primaryBtnBgd } ;
21+ border-radius: 50%;
22+ width: 100%;
23+ height: 100%;
24+ animation: ${ spin } 1s linear infinite;
25+ display: block;
26+ ` ;
3027
3128export type LoadingWrapperProps = BaseComponentProps & {
3229 borderColor ?: CSSProperties [ 'borderColor' ] ;
@@ -36,9 +33,8 @@ const LoadingWrapper: IStyledComponent<
3633 'web' ,
3734 LoadingWrapperProps
3835> = styled . div < LoadingWrapperProps > `
39- border-radius: 50%;
40- border: 3px solid ${ props => props . borderColor || props . theme . borderColorLT } ;
41- padding: 2px;
36+ display: inline-block;
37+ position: relative;
4238` ;
4339
4440export type LoadingSpinnerProps = {
@@ -53,17 +49,13 @@ const LoadingSpinner: React.FC<LoadingSpinnerProps> = ({
5349 size = 32 ,
5450 color = '' ,
5551 borderColor = '' ,
56- strokeWidth = 3 ,
57- gap = 2
52+ strokeWidth = 2 ,
53+ gap = 0
5854} ) => (
59- < LoadingWrapper
60- style = { { width : `${ size } px` , height : `${ size } px` , padding : `${ gap } px` , borderColor} }
61- >
55+ < LoadingWrapper style = { { width : `${ size } px` , height : `${ size } px` } } >
6256 < Loader
6357 color = { color }
6458 style = { {
65- width : `${ size - strokeWidth * 2 - gap * 2 } px` ,
66- height : `${ size - strokeWidth * 2 - gap * 2 } px` ,
6759 borderWidth : strokeWidth
6860 } }
6961 />
0 commit comments