refactoring and implementing refreshing items list every 2 seconds

This commit is contained in:
egradanin
2019-01-14 22:41:53 +01:00
parent a431c58763
commit ae446d5333
19 changed files with 166 additions and 154 deletions

View File

@@ -5,7 +5,7 @@ class CheckboxAndRadioWrapper extends React.Component {
optionChange = (option, optionName, type) => {
const optionTypePicker = {
radio: option.target.value,
checkbox: option.target.checked
checkbox: option.target.checked ? option.target.value : false
};
const { onOptionChanged } = this.props;
onOptionChanged({
@@ -15,10 +15,9 @@ class CheckboxAndRadioWrapper extends React.Component {
};
isChecked = (type, value, optionName) => {
const { options } = this.props;
return type === "checkbox"
? value
: options.hasOwnProperty(optionName) &&
options[optionName] === String(value);
return options.hasOwnProperty(optionName) && type === "checkbox"
? options[optionName]
: options[optionName] === String(value);
};
renderElements = (elements, componentName) => {
return elements.map(({ type, value, name, optionName } = {}) => (