diff --git a/src/components/shared/filter-chips.tsx b/src/components/shared/filter-chips.tsx new file mode 100644 index 0000000..cd5a453 --- /dev/null +++ b/src/components/shared/filter-chips.tsx @@ -0,0 +1,67 @@ +'use client'; + +import { X, Filter } from 'lucide-react'; + +import { cn } from '@/lib/utils'; + +export type ActiveFilter = { + id: string; + label: string; + /** Compact value rendered on the chip after the label (e.g. ": Active"). */ + value?: string; +}; + +/** + * Horizontal chip row for active filters, with an "Add filter" trigger that + * the caller wires to a ``. Active chips are dismissable via the X + * button. Scrolls horizontally on mobile when there are many filters. + */ +export function FilterChips({ + active, + onRemove, + onAddClick, + className, +}: { + active: ActiveFilter[]; + onRemove: (id: string) => void; + onAddClick: () => void; + className?: string; +}) { + return ( +
+ + + {active.map((filter) => ( + + + {filter.label} + {filter.value ? `: ${filter.value}` : ''} + + + + ))} +
+ ); +}