Files
cameleer-server/ui/src/components/SeverityBadge.tsx

21 lines
553 B
TypeScript
Raw Normal View History

import { Badge } from '@cameleer/design-system';
import type { AlertDto } from '../api/queries/alerts';
type Severity = NonNullable<AlertDto['severity']>;
const LABELS: Record<Severity, string> = {
CRITICAL: 'Critical',
WARNING: 'Warning',
INFO: 'Info',
};
const COLORS: Record<Severity, 'auto' | 'warning' | 'error'> = {
CRITICAL: 'error',
WARNING: 'warning',
INFO: 'auto',
};
export function SeverityBadge({ severity }: { severity: Severity }) {
return <Badge label={LABELS[severity]} color={COLORS[severity]} variant="filled" />;
}