fix key value input field

This commit is contained in:
Eduard Heimbuch
2020-07-13 11:34:51 +02:00
parent 3f2e052057
commit 2e4db3e584

View File

@@ -75,6 +75,12 @@ const AddKeyValueEntryToTableField: FC<Props> = ({
}
};
const add = () => {
addEntry(key, value);
setKey("")
setValue("");
}
return (
<InputLevel>
<StyledInputField
@@ -83,7 +89,7 @@ const AddKeyValueEntryToTableField: FC<Props> = ({
onChange={setKey}
validationError={!isValid(key)}
value={key}
onReturnPressed={() => addEntry(key, value)}
onReturnPressed={add}
disabled={disabled}
helpText={keyHelpText}
/>
@@ -93,13 +99,13 @@ const AddKeyValueEntryToTableField: FC<Props> = ({
onChange={setValue}
validationError={!isValid(value)}
value={value}
onReturnPressed={() => addEntry(key, value)}
onReturnPressed={add}
disabled={disabled}
helpText={valueHelpText}
/>
<MarginTopButton
label={buttonLabel}
action={() => addEntry(key, value)}
action={add}
disabled={disabled || !key || !value || !isValid(key) || !isValid(value)}
/>
</InputLevel>