mirror of
https://github.com/tomru/pdfer.git
synced 2026-03-03 06:27:19 +01:00
31 lines
685 B
TypeScript
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>
|
|
</>
|
|
)
|
|
}
|