import { MapPin, Store } from 'lucide-react'; import { cn } from '@/lib/utils'; import type { SearchSuggestion } from '@/lib/mapSearchSuggestions'; interface MapSearchSuggestionsProps { suggestions: SearchSuggestion[]; activeIndex: number; spotsLabel: string; placesLabel: string; emptyLabel: string; onHover: (index: number) => void; onSelect: (suggestion: SearchSuggestion) => void; } /** * Dropdown panel for the map search bar. Purely presentational: the parent owns * the suggestion list (see `buildSearchSuggestions` in * `@/lib/mapSearchSuggestions`), the active index and selection. */ export function MapSearchSuggestions({ suggestions, activeIndex, spotsLabel, placesLabel, emptyLabel, onHover, onSelect, }: MapSearchSuggestionsProps) { return (
e.preventDefault()} className="absolute left-0 right-0 top-full z-[1001] mt-2 max-h-80 overflow-y-auto rounded-2xl border border-white/15 bg-black/95 p-1.5 shadow-2xl backdrop-blur-md" > {suggestions.length === 0 ? (
{emptyLabel}
) : ( suggestions.map((s, index) => { const header = index === 0 || suggestions[index - 1].kind !== s.kind ? s.kind === 'spot' ? spotsLabel : placesLabel : null; const active = index === activeIndex; return (
{header && (
{header}
)}
); }) )}
); }