Files
old-web/frontend-react/src/components/widgets/SelectWrapper.js
2019-01-12 14:09:17 +01:00

26 lines
624 B
JavaScript

import React from "react";
import Select from "react-select";
import { optionchangewrapper } from "utils/optionchangewrapper";
class SelectWrapper extends React.Component {
handleOptionChange = selectedOption => {
const { onOptionChanged, optionName } = this.props;
onOptionChanged({
optionName,
optionValue: selectedOption
});
};
render() {
let { value, options, choices } = this.props;
return (
<Select
value={options[value]}
onChange={this.handleOptionChange}
options={choices}
/>
);
}
}
export default optionchangewrapper(SelectWrapper);