File size: 1,190 Bytes
3e33e2e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
export function LoadingSkeleton({
  lines = 4,
  height = "20px",
  className = "",
}: {
  lines?: number;
  height?: string | number;
  className?: string;
}) {
  const heightStyle = typeof height === "number" ? `${height}px` : height;
  return (
    <div className={`skeleton-container ${className}`}>
      {Array.from({ length: lines }).map((_, i) => (
        <div
          key={i}
          className="skeleton-bar"
          style={{ height: heightStyle, width: i === lines - 1 ? "60%" : "100%" }}
        />
      ))}
    </div>
  );
}

export function CardSkeleton() {
  return (
    <div className="skeleton-card">
      <div className="skeleton-bar" style={{ height: "14px", width: "40%", marginBottom: "12px" }} />
      <div className="skeleton-bar" style={{ height: "32px", width: "70%", marginBottom: "8px" }} />
      <div className="skeleton-bar" style={{ height: "12px", width: "50%" }} />
    </div>
  );
}

export function ChartSkeleton({ height = 320 }: { height?: number }) {
  return (
    <div className="skeleton-chart" style={{ height: `${height}px` }}>
      <div className="spinner" />
      <span>Loading historical research series...</span>
    </div>
  );
}