| 1 |
import React from 'react'; |
| 2 |
import Select from 'react-select'; |
| 3 |
|
| 4 |
|
| 5 |
const PropertyDropdown = (props) => { |
| 6 |
let selectOptions = []; |
| 7 |
|
| 8 |
for (let option in props.property.options) { |
| 9 |
selectOptions.push({ |
| 10 |
value: option, |
| 11 |
label: props.property.options[option], |
| 12 |
}); |
| 13 |
} |
| 14 |
|
| 15 |
return ( |
| 16 |
<Select |
| 17 |
className="wpupg-template-property-input" |
| 18 |
menuPlacement="top" |
| 19 |
value={selectOptions.filter(({value}) => value === props.value)} |
| 20 |
onChange={(option) => props.onValueChange(option.value)} |
| 21 |
options={selectOptions} |
| 22 |
clearable={false} |
| 23 |
/> |
| 24 |
); |
| 25 |
} |
| 26 |
|
| 27 |
export default PropertyDropdown; |