need to fix window message
This commit is contained in:
parent
6c9e0aaa1a
commit
2a2ddf205a
23 changed files with 126 additions and 161 deletions
20
website/src/repl/components/panel/SelectInput.jsx
Normal file
20
website/src/repl/components/panel/SelectInput.jsx
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import React from 'react';
|
||||
// value: ?ID, options: Map<ID, any>, onChange: ID => null, onClick: event => void, isDisabled: boolean
|
||||
export function SelectInput({ value, options, onChange, onClick, isDisabled }) {
|
||||
return (
|
||||
<select
|
||||
disabled={isDisabled}
|
||||
onClick={onClick}
|
||||
className="p-2 bg-background rounded-md text-foreground"
|
||||
value={value ?? ''}
|
||||
onChange={(e) => onChange(e.target.value)}
|
||||
>
|
||||
{options.size == 0 && <option value={value}>{`${value ?? 'select an option'}`}</option>}
|
||||
{Array.from(options.keys()).map((id) => (
|
||||
<option key={id} className="bg-background" value={id}>
|
||||
{options.get(id)}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue