File size: 1,483 Bytes
518343a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
43
import type { Classification } from '../../lib/infrastructure/imperium-data';
import { cn } from '../../lib/infrastructure/utils';
import { AlertTriangle, Globe, Lock, Shield } from 'lucide-react';
import type React from 'react';

const CONFIG: Record<
  Classification,
  { label: string; icon: React.ElementType; className: string }
> = {
  OPEN: { label: 'OPEN', icon: Globe, className: 'classification-open' },
  RESTRICTED: { label: 'RESTRICTED', icon: AlertTriangle, className: 'classification-restricted' },
  CONFIDENTIAL: { label: 'CONFIDENTIAL', icon: Lock, className: 'classification-confidential' },
  SOVEREIGN: { label: 'SOVEREIGN', icon: Shield, className: 'classification-sovereign' },
};

export function ClassificationBadge({
  classification,
  size = 'sm',
}: {
  classification: Classification;
  size?: 'xs' | 'sm' | 'md';
}) {
  const cfg = CONFIG[classification];
  const Icon = cfg.icon;
  const textSize = size === 'xs' ? 'text-[9px]' : size === 'sm' ? 'text-[10px]' : 'text-xs';
  const iconSize = size === 'xs' ? 'w-2.5 h-2.5' : size === 'sm' ? 'w-3 h-3' : 'w-3.5 h-3.5';
  const padding = size === 'xs' ? 'px-1.5 py-0.5' : size === 'sm' ? 'px-2 py-0.5' : 'px-2.5 py-1';

  return (
    <div
      className={cn(
        'inline-flex items-center gap-1 rounded border font-mono tracking-widest font-semibold',
        textSize,
        padding,
        cfg.className,
      )}
    >
      <Icon className={iconSize} />
      {cfg.label}
    </div>
  );
}