import { FilterBarButton, Color } from './FilterBarButton'; import { FilterBarActiveIndicator } from './FilterBarActiveIndicator'; export interface StatusSegment { key: string; label: string; count: number; color: Color; } interface Props { total: number; segments: StatusSegment[]; value: string | null; onChange: (filter: string | null) => void; radioGroupName?: string; ariaLabel?: string; 'data-cy'?: string; } export function StatusSummaryBar({ total, segments, value, onChange, radioGroupName = 'status-summary-filter', ariaLabel = 'Filter by status', 'data-cy': dataCy = 'status-summary-bar', }: Props) { const isAllSelected = !value; const activeLabel = segments.find((s) => s.key === value)?.label; function handleSegmentClick(key: string) { onChange(value === key ? null : key); } return (