jsxImportSource emotion import * as React from "react" ; import { keyframes , css , SerializedStyles } from "@emotion/react" ; import { sizeDefaults , cssValue } from "./helpers" ; import { LoaderSizeProps } from "./interfaces" ; const bounce = keyframes `
  0%, 100% {transform: scale(0)}
  50% {transform: scale(1.0)}
` ; class Loader extends React . PureComponent < Required < LoaderSizeProps > > { public static defaultProps = sizeDefaults ( 60 ) ; public style = ( i ) : SerializedStyles => { const { color , size , speedMultiplier } = this . props ; return css `
      position: absolute;
      height: ${ cssValue ( size ) };
      width: ${ cssValue ( size ) };
      background-color: ${ color };
      border-radius: 100%;
      opacity: 0.6;
      top: 0;
      left: 0;
      animation-fill-mode: both;
      animation: ${ bounce } ${ 2.1 / speedMultiplier }s ${ i === 1 ? `${ 1 / speedMultiplier }s` : "0s" } infinite ease-in-out;
    ` ; } ; public wrapper = ( ) : SerializedStyles => { const { size } = this . props ; return css `
      position: relative;
      width: ${ cssValue ( size ) };
      height: ${ cssValue ( size ) };
    ` ; } ; public render ( ) { const { loading , css } = this . props ; return loading ? ( < span css = { [ this . wrapper ( ) , css ] } > < span css = { this . style ( 1 ) } /> < span css = { this . style ( 2 ) } / > < /span>) : null; } } export default Loader ;