import type { ComponentProps } from 'react' import { cn } from 'ui' import { SEVERITY_LABELS } from './Issues.constants' import type { IssueSeverity } from '@/data/issues/issue.types' const FILLED_BAR_COUNT: Record = { info: 1, warning: 2, critical: 3, } const FILLED_BAR_COLORS: Record = { info: 'text-foreground-lighter', warning: 'text-warning', critical: 'text-destructive', } const BAR_HEIGHTS = [4, 7, 10] type SeverityIndicatorProps = { severity: IssueSeverity } & Omit, 'children'> /** * Three ascending bars, filled up to the issue's severity in its color: one gray bar for info, * two yellow for warning, three red for critical. Pass `aria-hidden` when the severity label is * already shown next to it. */ export const SeverityIndicator = ({ severity, className, ...props }: SeverityIndicatorProps) => { const filledBarCount = FILLED_BAR_COUNT[severity] return ( {BAR_HEIGHTS.map((height, index) => ( ))} ) }