import * as React from "react"; import * as PropTypes from "prop-types"; import styled, { keyframes } from "styled-components"; import { colors } from "../styles"; const load = keyframes` 0% { transform: scale(1.0); } 5% { transform: scale(1.0); } 50% { transform: scale(0.8); } 95% { transform: scale(1.0); } 100% { transform: scale(1.0); } `; interface LoaderStyleProps { size: number; } interface LoaderProps extends LoaderStyleProps { color: string; rgb?: string; } const SLoader = styled.svg` width: ${({ size }) => `${size}px`}; height: ${({ size }) => `${size}px`}; animation: ${load} 1s infinite cubic-bezier(0.25, 0, 0.75, 1); transform: translateZ(0); `; const Loader = (props: LoaderProps) => { const { size, color } = props; const rgb = props.rgb || `rgb(${colors[color]})`; return ( ); }; Loader.propTypes = { size: PropTypes.number, color: PropTypes.string, }; Loader.defaultProps = { size: 40, color: "lightBlue", }; export default Loader;