• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

davidhu2000 / react-spinners / 14458015078

14 Apr 2025 11:47PM UTC coverage: 71.708%. Remained the same
14458015078

push

github

web-flow
fix: add use client to ensure loaders run on server components  (#639)

fix

1154 of 1753 branches covered (65.83%)

Branch coverage included in aggregate %.

1122 of 1421 relevant lines covered (78.96%)

6.97 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

70.08
/src/PuffLoader.tsx
1
"use client";
2

3
import * as React from "react";
1✔
4

1!
5
import { cssValue } from "./helpers/unitConverter";
×
6
import { LoaderSizeProps } from "./helpers/props";
×
7
import { createAnimation } from "./helpers/animation";
×
8

×
9
const puff = [
10
  createAnimation("PuffLoader", "0% {transform: scale(0)} 100% {transform: scale(1.0)}", "puff-1"),
×
11
  createAnimation("PuffLoader", "0% {opacity: 1} 100% {opacity: 0}", "puff-2"),
12
];
1✔
13

14
function PuffLoader({
1!
15
  loading = true,
41!
16
  color = "#000000",
41✔
17
  speedMultiplier = 1,
41!
18
  cssOverride = {},
41✔
19
  size = 60,
20
  ...additionalprops
41✔
21
}: LoaderSizeProps) {
22
  const wrapper: React.CSSProperties = {
×
23
    display: "inherit",
×
24
    position: "relative",
25
    width: cssValue(size),
1!
26
    height: cssValue(size),
1✔
27
    ...cssOverride,
28
  };
×
29

30
  const style = (i: number): React.CSSProperties => {
1✔
31
    return {
1✔
32
      position: "absolute",
1!
33
      height: cssValue(size),
×
34
      width: cssValue(size),
×
35
      border: `thick solid ${color}`,
×
36
      borderRadius: "50%",
37
      opacity: "1",
1✔
38
      top: "0",
39
      left: "0",
1✔
40
      animationFillMode: "both",
1!
41
      animation: `${puff[0]}, ${puff[1]}`,
1✔
42
      animationDuration: `${2 / speedMultiplier}s`,
41!
43
      animationIterationCount: "infinite",
1✔
44
      animationTimingFunction:
1✔
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
    };
1✔
48
  };
3✔
49

3✔
50
  if (!loading) {
1✔
51
    return null;
3!
52
  }
3✔
53

×
54
  return (
×
55
    <span style={wrapper} {...additionalprops}>
56
      <span style={style(1)} />
3✔
57
      <span style={style(2)} />
58
    </span>
1✔
59
  );
1✔
60
}
1✔
61

1✔
62
export default PuffLoader;
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc