Files
pdfer/components/Select.tsx
Thomas Ruoff 0aaccf6966 more styling
2021-02-28 23:28:05 +01:00

31 lines
685 B
TypeScript

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