Full refactor to Typescript

This commit is contained in:
2022-11-17 19:19:33 +01:00
parent de3f10b3ee
commit ffd3c99292
19 changed files with 180 additions and 95 deletions
+23
View File
@@ -0,0 +1,23 @@
import { StateUpdater } from 'preact/hooks'
import { JSX } from 'preact/jsx-runtime'
type Props = {
options: Record<string, string>
value: string
setValue?: StateUpdater<string>
}
export const Select = ({ options, value, setValue }: Props) => (
<div class="input-select">
<select
onInput={e => setValue?.(e.target instanceof HTMLSelectElement ? e.target.value : '')}
>
{Object.entries(options).map(([k, v]) => (
<option value={k} selected={value === k}>
{v}
</option>
))}
</select>
<span class="material-symbols-outlined">expand_more</span>
</div>
)