asi-calculator/components/Select/Select.tsx
Matthias Kretschmann 51143f5980
migrate to biome (#28)
* migrate to biome

* get biome config from @kremalicious/config
2024-07-26 13:16:59 +01:00

23 lines
677 B
TypeScript

import { CaretDownIcon } from '@radix-ui/react-icons'
import type { SelectHTMLAttributes } from 'react'
import styles from './Select.module.css'
type Props = SelectHTMLAttributes<HTMLSelectElement> & {
options: { value: string; label: string }[]
}
export function Select({ options, ...rest }: Props) {
return (
<span className={styles.selectWrapper}>
<select className={styles.select} {...rest}>
{options.map((option) => (
<option key={option.value} value={option.value}>
{option.label}
</option>
))}
</select>
{options.length > 1 ? <CaretDownIcon className={styles.icon} /> : null}
</span>
)
}