| 12 | ]; |
| 13 | |
| 14 | function PuffLoader({ |
| 15 | loading = true, |
| 16 | color = "#000000", |
| 17 | speedMultiplier = 1, |
| 18 | cssOverride = {}, |
| 19 | size = 60, |
| 20 | ...additionalprops |
| 21 | }: LoaderSizeProps) { |
| 22 | const wrapper: React.CSSProperties = { |
| 23 | display: "inherit", |
| 24 | position: "relative", |
| 25 | width: cssValue(size), |
| 26 | height: cssValue(size), |
| 27 | ...cssOverride, |
| 28 | }; |
| 29 | |
| 30 | const style = (i: number): React.CSSProperties => { |
| 31 | return { |
| 32 | position: "absolute", |
| 33 | height: cssValue(size), |
| 34 | width: cssValue(size), |
| 35 | border: `thick solid ${color}`, |
| 36 | borderRadius: "50%", |
| 37 | opacity: "1", |
| 38 | top: "0", |
| 39 | left: "0", |
| 40 | animationFillMode: "both", |
| 41 | animation: `${puff[0]}, ${puff[1]}`, |
| 42 | animationDuration: `${2 / speedMultiplier}s`, |
| 43 | animationIterationCount: "infinite", |
| 44 | animationTimingFunction: |
| 45 | "cubic-bezier(0.165, 0.84, 0.44, 1), cubic-bezier(0.3, 0.61, 0.355, 1)", |
| 46 | animationDelay: i === 1 ? "-1s" : "0s", |
| 47 | }; |
| 48 | }; |
| 49 | |
| 50 | if (!loading) { |
| 51 | return null; |
| 52 | } |
| 53 | |
| 54 | return ( |
| 55 | <span style={wrapper} {...additionalprops}> |
| 56 | <span style={style(1)} /> |
| 57 | <span style={style(2)} /> |
| 58 | </span> |
| 59 | ); |
| 60 | } |
| 61 | |
| 62 | export default PuffLoader; |