Spaces:
Running
Running
File size: 896 Bytes
2eb87e3 | 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 | import { CircleAlert, OctagonAlert, Siren, TriangleAlert } from "lucide-react";
import type { Severity } from "@/shared/types";
import { severityLabel } from "../shared/lib/format";
const icon = {
critical: Siren,
high: OctagonAlert,
medium: TriangleAlert,
low: CircleAlert,
} as const;
const cls = {
critical: "bg-sev-critical-bg text-sev-critical-ink",
high: "bg-sev-high-bg text-sev-high-ink",
medium: "bg-sev-medium-bg text-sev-medium-ink",
low: "bg-sev-low-bg text-sev-low-ink",
} as const;
export function SeverityChip({ severity }: { severity: Severity }) {
const Icon = icon[severity] ?? CircleAlert;
const style = cls[severity] ?? cls.low;
return (
<span
className={`inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs font-medium ${style}`}
>
<Icon size={12} strokeWidth={2} />
{severityLabel(severity)}
</span>
);
}
|