File size: 1,176 Bytes
1e92f2d |
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 47 48 49 50 |
import { keyframes } from '@emotion/react';
import styled from '@emotion/styled';
const rotate = keyframes`
100% {
transform: rotate( 360deg );
}
`;
const SpinnerWrapper = styled.div`
display: block;
width: 20px;
height: 20px;
border: 3px solid transparent;
border-top-color: ${ ( props ) => props.theme.colors.highlight };
border-radius: 100%;
box-sizing: border-box;
position: relative;
animation: ${ rotate } 3s linear infinite;
animation-fill-mode: backwards;
::after {
position: absolute;
top: 0;
left: -1px;
width: 17px;
height: 17px;
border: 3px solid transparent;
border-top-color: ${ ( props ) => props.theme.colors.highlight };
border-right-color: ${ ( props ) => props.theme.colors.highlight };
box-sizing: border-box;
opacity: 0.5;
content: '';
border-radius: 100%;
animation: ${ rotate } 3s linear infinite;
animation-fill-mode: backwards;
.rtl & {
border-right-color: transparent;
border-left-color: ${ ( props ) => props.theme.colors.highlight };
right: -1px;
left: auto;
}
}
`;
export default function Spinner( { className = undefined } ) {
return <SpinnerWrapper className={ className } />;
}
|