import React from 'react'
import { Choice } from '../types'

type Props = {
  choices: Choice[]
  onSelect: (id: string) => void
}

export const ChoiceMenu: React.FC<Props> = ({ choices, onSelect }) => {
  if (!choices.length) return null
  return (
    <div className="choice-menu">
      {choices.map((c) => (
        <button key={c.id} className="choice-item" onClick={() => onSelect(c.id)}>
          {c.label}
        </button>
      ))}
    </div>
  )
}
