import styled, { css } from 'styled-components'; import { ILoader } from './Loader.interface'; import { colors } from '@/styles/variables'; export const StyledLoader = styled.div` display: inline-block; text-align: center; & > div { position: relative; width: 5rem; height: 5rem; &::before, &::after { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; border-radius: 50%; } &::before{ border-style: solid solid dotted dotted; animation: rotation 2s linear infinite; } &::after { top:50%; left: 50%; max-width: 2rem; max-height: 2rem; margin-top: -1rem; margin-left: -1rem; border-style: solid solid dotted; animation: rotationBack 1s linear infinite; transform-origin: center center; } } ${(props) => { switch (props.$variant) { case "dark": default: return css` & > div { &::before{ border: 3px dotted ${colors.white}; } &::after { border: 3px dotted ${colors.white}; } } `; case "light": return css` & > div { &::before{ border: 3px dotted ${colors.primary70}; } &::after { border: 3px dotted ${colors.primary70}; } } `; } }} @keyframes rotation { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } @keyframes rotationBack { 0% { transform: rotate(0deg); } 100% { transform: rotate(-360deg); } } `;