import type { SelectHTMLAttributes } from 'react';

type Props = SelectHTMLAttributes<HTMLSelectElement> & {
  label: string;
  options: Array<{ value: string | number; label: string }>;
};

export function SelectInput({ label, options, ...props }: Props) {
  return (
    <label className="form-field">
      <span>{label}</span>
      <select {...props}>
        {options.map((option) => <option key={option.value} value={option.value}>{option.label}</option>)}
      </select>
    </label>
  );
}
