Filter out combining operator select

This commit is contained in:
Lukas Martinelli
2017-01-09 17:47:35 +01:00
parent ba0a94f3ad
commit fed530f5f2
4 changed files with 87 additions and 64 deletions

View File

@@ -11,9 +11,10 @@ class SelectInput extends React.Component {
render() {
const options = this.props.options.map(([val, label])=> {
return <option key={val} value={val}>{label}</option>
})
let options = this.props.options
if(options.length > 0 && !Array.isArray(options[0])) {
options = options.map(v => [v, v])
}
return <select
style={{
@@ -23,7 +24,7 @@ class SelectInput extends React.Component {
value={this.props.value}
onChange={e => this.props.onChange(e.target.value)}
>
{options}
{ options.map(([val, label]) => <option key={val} value={val}>{label}</option>) }
</select>
}
}