summaryrefslogtreecommitdiff
path: root/src/components/shared/Select.tsx
blob: 64bd59cfa1049512b9da835a786a9c4cae4304f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import cx from 'clsx';
import * as React from 'react';

import s from './Select.module.scss';

type Props = {
  options: Array<string[]>;
  selected: string;
} & React.SelectHTMLAttributes<HTMLSelectElement>;

export default function Select({ options, selected, onChange, className, ...props }: Props) {
  return (
    // eslint-disable-next-line jsx-a11y/no-onchange
    <select className={cx(s.select, className)} value={selected} onChange={onChange} {...props}>
      {options.map(([value, name]) => (
        <option key={value} value={value}>
          {name}
        </option>
      ))}
    </select>
  );
}