mirror of
https://github.com/zadam/trilium.git
synced 2025-10-29 17:26:38 +01:00
25 lines
716 B
TypeScript
25 lines
716 B
TypeScript
|
|
interface FormSelectProps {
|
||
|
|
currentValue?: string;
|
||
|
|
onChange(newValue: string): void;
|
||
|
|
values: { val: string, title: string }[];
|
||
|
|
}
|
||
|
|
|
||
|
|
export default function FormSelect({ currentValue, values, onChange }: FormSelectProps) {
|
||
|
|
return (
|
||
|
|
<select
|
||
|
|
class="form-select"
|
||
|
|
onChange={e => onChange((e.target as HTMLInputElement).value)}
|
||
|
|
>
|
||
|
|
{values.map(item => {
|
||
|
|
return (
|
||
|
|
<option
|
||
|
|
value={item.val}
|
||
|
|
selected={item.val === currentValue}
|
||
|
|
>
|
||
|
|
{item.title}
|
||
|
|
</option>
|
||
|
|
);
|
||
|
|
})}
|
||
|
|
</select>
|
||
|
|
)
|
||
|
|
}
|