File size: 967 Bytes
5a81b95
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import { cn } from '@/lib/utils';

interface StatusIndicatorProps {
  status: 'online' | 'offline' | 'warning' | 'loading';
  label: string;
  className?: string;
}

const StatusIndicator = ({ status, label, className }: StatusIndicatorProps) => {
  const statusColors = {
    online: 'bg-primary',
    offline: 'text-destructive bg-destructive',
    warning: 'bg-warning',
    loading: 'bg-accent animate-pulse',
  };

  return (
    <div className={cn("flex items-center gap-2", className)}>
      <div className="relative">
        <div className={cn(
          "w-2 h-2 rounded-full",
          statusColors[status]
        )} />
        {status === 'online' && (
          <div className="absolute inset-0 w-2 h-2 rounded-full bg-primary animate-ping opacity-75" />
        )}
      </div>
      <span className="font-mono text-xs uppercase tracking-wider text-muted-foreground">
        {label}
      </span>
    </div>
  );
};

export default StatusIndicator;