File size: 933 Bytes
1684141
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import { cn } from "@/lib/utils";

interface LoadingSpinnerProps {
  size?: "sm" | "md" | "lg";
  text?: string;
  className?: string;
}

export default function LoadingSpinner({ size = "md", text, className }: LoadingSpinnerProps) {
  const sizeClasses = {
    sm: "h-4 w-4",
    md: "h-8 w-8", 
    lg: "h-12 w-12"
  };

  const textSizes = {
    sm: "text-xs",
    md: "text-sm",
    lg: "text-base"
  };

  return (
    <div className={cn("flex flex-col items-center justify-center", className)} role="status" aria-live="polite">
      <div 
        className={cn(
          "animate-spin rounded-full border-2 border-gray-200 border-t-primary", 
          sizeClasses[size]
        )}
        aria-hidden="true"
      />
      {text && (
        <p className={cn("mt-2 text-gray-600", textSizes[size])} id="loading-text">
          {text}
        </p>
      )}
      <span className="sr-only">Loading...</span>
    </div>
  );
}