// ----------------------------------------------------------------------------- // Groupe KA — shared component (Home-Ka edition) // components/AmenityIco.tsx : contextual icon for a feature/amenity label. // Each label is matched by keyword (accents neutralized) to one of the ~30 // house pictograms — 1.8 stroke, 24×24, currentColor. Fallback: ✓. // ----------------------------------------------------------------------------- import { ReactNode } from "react"; const ICONS: Record = { heat: (<>), bolt: , droplet: (<>), wifi: , dishwasher: (<>), washer: (<>), fridge: (<>), snow: , elevator: (<>), balcony: , pool: , gym: , laundry: , box: , parking: (<>), garage: , sofa: , nosmoke: , paw: (<>), fire: (<>), tree: , spa: , shield: (<>), eye: (<>), waves: , calendar: (<>), ruler: , bed: , bath: , people: (<>), stairs: , door: (<>), home: , sun: (<>), check: , spark: , }; /** [pattern (on lowercase accent-free label), icon key] — order = priority */ const RULES: [RegExp, string][] = [ [/dish ?washer/, "dishwasher"], [/washer|dryer|laundry hookup/, "washer"], [/laundry/, "laundry"], [/appliance|fridge|refrigerator|range\b|oven|stove|microwave/, "fridge"], [/air condition|central air|cooling|heat pump|\ba\/?c\b|hvac/, "snow"], [/heat|furnace|radiant|baseboard/, "heat"], [/water heater|hot water/, "droplet"], [/electric|solar|generator/, "bolt"], [/internet|wi-?fi|\bcable\b|fiber/, "wifi"], [/elevator/, "elevator"], [/balcon|terrace|patio|porch|deck|veranda/, "balcony"], [/pool/, "pool"], [/gym|fitness|exercise/, "gym"], [/storage|closet|walk-?in|pantry|shed/, "box"], [/garage/, "garage"], [/parking|carport|driveway/, "parking"], [/furnish/, "sofa"], [/non-?smoking|smoke-?free/, "nosmoke"], [/\bpet\b|\bdog\b|\bcat\b/, "paw"], [/fireplace|wood stove|chimney/, "fire"], [/spa\b|jacuzzi|sauna|hot tub|whirlpool/, "spa"], [/security|surveillance|camera|alarm|intercom|gated|doorman/, "shield"], [/\bview\b|panoram/, "eye"], [/waterfront|lake|river|beach|ocean|dock|boat/, "waves"], [/yard|garden|tree|wooded|lawn|landscap|fence/, "tree"], [/sunn?y|natural light|bright|sunroom|skylight/, "sun"], [/available|move-?in/, "calendar"], [/sq ?ft|square (feet|foot)|acre/, "ruler"], [/bed ?room|\bbed\b/, "bed"], [/bath ?room|\bbath\b|shower/, "bath"], [/occupant|tenant|resident/, "people"], [/stor(y|ies)|floor|stair|level|basement|attic|loft/, "stairs"], [/studio|\bunit\b/, "door"], [/single ?family|ranch|bungalow|house/, "home"], [/sewer|septic/, "waves"], [/water supply|well water|city water/, "droplet"], [/construction|new build|foundation|roof|siding|remodel|renovat|updated/, "home"], [/commercial|zoning|use\b/, "box"], ]; /** lowercase + accents neutralized, for robust matching */ const norm = (s: string) => s.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, ""); export function amenityKey(label: string, fallback = "check"): string { const n = norm(label); for (const [re, key] of RULES) if (re.test(n)) return key; return fallback; } export default function AmenityIco({ label, size = 16, fallback = "check" }: { label: string; size?: number; fallback?: string }) { return ( ); }