import { TouchableOpacity, View, StyleSheet, } from 'react-native'; import { Text } from '@/components/ui/Text'; import { Colors } from '@/constants/theme'; export type CategoryOption = { label: string; value: T; icon: React.ReactNode; }; type Props = { options: CategoryOption[]; active: T | null; onChange: (value: T) => void; columns?: number; }; export function CategoryChips({ options, active, onChange, columns = 2, }: Props) { return ( {options.map((option) => { const isActive = option.value === active; return ( onChange(option.value)} activeOpacity={0.7} style={[ styles.chip, { width: `${100 / columns - 2}%` }, isActive && styles.chipActive, ]} > {option.icon} {option.label} ); })} ); } const styles = StyleSheet.create({ grid: { flexDirection: 'row', flexWrap: 'wrap', gap: 10, paddingHorizontal: 16, paddingVertical: 8, }, chip: { paddingHorizontal: 16, paddingVertical: 12, borderRadius: 999, backgroundColor: '#fff', borderWidth: 1.5, borderColor: 'transparent', }, chipActive: { backgroundColor: Colors.light.tint + '1A', // ~10% opacity tint background borderColor: Colors.light.tint, }, chipInner: { flexDirection: 'row', alignItems: 'center', gap: 8, }, iconWrapper: { width: 20, height: 20, alignItems: 'center', justifyContent: 'center', }, label: { fontSize: 14, fontWeight: '500', color: '#3C3C43', letterSpacing: -0.1, }, labelActive: { fontWeight: '600', }, });