MCPcopy Create free account
hub / github.com/davidhu2000/react-spinners / ScaleLoader

Function ScaleLoader

src/ScaleLoader.tsx:15–56  ·  view source on GitHub ↗
({
  loading = true,
  color = "#000000",
  speedMultiplier = 1,
  cssOverride = {},
  height = 35,
  width = 4,
  radius = 2,
  margin = 2,
  barCount = 5,
  ...additionalprops
}: LoaderHeightWidthRadiusProps & { barCount?: number })

Source from the content-addressed store, hash-verified

13);
14
15function ScaleLoader({
16 loading = true,
17 color = "#000000",
18 speedMultiplier = 1,
19 cssOverride = {},
20 height = 35,
21 width = 4,
22 radius = 2,
23 margin = 2,
24 barCount = 5,
25 ...additionalprops
26}: LoaderHeightWidthRadiusProps & { barCount?: number }) {
27 const wrapper: React.CSSProperties = {
28 display: "inherit",
29 ...cssOverride,
30 };
31
32 const style = (i: number): React.CSSProperties => {
33 return {
34 backgroundColor: color,
35 width: cssValue(width),
36 height: cssValue(height),
37 margin: cssValue(margin),
38 borderRadius: cssValue(radius),
39 display: "inline-block",
40 animation: `${scale} ${1 / speedMultiplier}s ${i * 0.1}s infinite cubic-bezier(0.2, 0.68, 0.18, 1.08)`,
41 animationFillMode: "both",
42 };
43 };
44
45 if (!loading) {
46 return null;
47 }
48
49 return (
50 <span style={wrapper} {...additionalprops}>
51 {[...Array(barCount)].map((_, i) => (
52 <span key={i} style={style(i + 1)} />
53 ))}
54 </span>
55 );
56}
57
58export default ScaleLoader;

Callers

nothing calls this directly

Calls 1

styleFunction · 0.70

Tested by

no test coverage detected