import React, { HTMLAttributes } from 'react'; import styled, { keyframes } from 'styled-components'; import LoadIcon from '../icons/loading.svg'; export interface LoadingProps extends HTMLAttributes { children?: React.ReactNode; loading?: boolean; } const LoadingStyled = styled.div` position: relative; `; const loadAction = keyframes` from{ transform: rotate(0deg); } to{ transform: rotate(360deg); } `; const LoadWrap = styled.span` position: absolute; top: 30%; left: 50%; transform: translate(-50%, -50%); > .inner { animation: ${loadAction} infinite 1s linear; display: inline-flex; align-items: center; justify-content: center; } `; const Loading: React.FC = (props) => { const { children, loading, ...rest } = props; return (
{children}
); }; Loading.defaultProps = { children: '', loading: true }; export default Loading;