import { useState } from 'react'; import { Chip, HStack } from '@cdx-ui/components'; import { Check } from '@cdx-ui/icons'; import { FILTER_CATEGORIES, type FilterCategory } from './data'; export function CategorySelectionChips() { const [selected, setSelected] = useState>( () => new Set(['Groceries', 'Home', 'Health']), ); const toggleCategory = (category: FilterCategory) => { setSelected((prev) => { const next = new Set(prev); if (next.has(category)) { next.delete(category); } else { next.add(category); } return next; }); }; return ( {FILTER_CATEGORIES.map((lbl) => { const isSelected = selected.has(lbl); return ( toggleCategory(lbl)} > {isSelected ? : null} {lbl} ); })} ); }