Fix bugs with toggle and drop down
This commit is contained in:
parent
ee2dbe0f7b
commit
0a2c46c37b
2 changed files with 3 additions and 3 deletions
|
|
@ -14,7 +14,7 @@ import Input from "@material-ui/core/Input";
|
||||||
|
|
||||||
const componentId = (item: UIDropDown) => `dropdown-${item.topic}`;
|
const componentId = (item: UIDropDown) => `dropdown-${item.topic}`;
|
||||||
|
|
||||||
const DropDownOptions = ({options}) =>
|
const DropDownOptions = (options) =>
|
||||||
map(options, (v, k) => <MenuItem value={k} key={k}>{v}</MenuItem>);
|
map(options, (v, k) => <MenuItem value={k} key={k}>{v}</MenuItem>);
|
||||||
|
|
||||||
const onChangeEvent = (item: UIDropDown, changeState) =>
|
const onChangeEvent = (item: UIDropDown, changeState) =>
|
||||||
|
|
@ -30,7 +30,7 @@ const BaseComponent = ({Icon}, item, state, changeState) => (
|
||||||
disabled={isDisabled(item, state)}
|
disabled={isDisabled(item, state)}
|
||||||
input={<Input id={componentId(item)} />}
|
input={<Input id={componentId(item)} />}
|
||||||
>
|
>
|
||||||
<DropDownOptions options={item.options} />
|
{DropDownOptions(item.options)}
|
||||||
</Select>
|
</Select>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ const isToggled = (item: UIToggle, state: State) => {
|
||||||
return checked;
|
return checked;
|
||||||
};
|
};
|
||||||
|
|
||||||
const doToggle = (item: UIToggle, state: State, changeState) => {
|
const doToggle = (item: UIToggle, state: State, changeState) => () => {
|
||||||
if (isEnabled(item, state)) {
|
if (isEnabled(item, state)) {
|
||||||
const toggled = isToggled(item, state);
|
const toggled = isToggled(item, state);
|
||||||
const on = item.on == null ? "on" : item.on;
|
const on = item.on == null ? "on" : item.on;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue