import React from 'react'

export default function Select({
  name,
  text,
  value,
  onchange,
  options = [],
}: {
  name: string
  text: string
  value: string
  onchange: (name: string, event: React.ChangeEvent<{ value: string }>) => void
  options: { name: string; value: string }[]
}) {
  return (
    <label>
      {text}
      <select className={name} onChange={onchange.bind(null, name)} value={value}>
        {options.map((option) => (
          <option value={option.value} key={option.value}>
            {option.name}
          </option>
        ))}
      </select>
    </label>
  )
}
