import "../../styles/components/SuggestionList.css";

interface Props {
  suggestions: string[];
  onSelect: (value: string) => void;
}

export default function SuggestionList({ suggestions, onSelect }: Props) {
  if (!suggestions.length) return null;

  return (
    <ul className="suggestion-list">
      {suggestions.map((s) => (
        <li
          key={s}
          onClick={() => onSelect(s)}
          className="suggestion-item"
        >
          {s}
        </li>
      ))}
    </ul>
  );
}
