summaryrefslogtreecommitdiff
path: root/frontend/src/components/ChoiceMenu.tsx
blob: 0de86f68bf09842c8185e38f3312171049cbd2e3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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>
  )
}