diff --git a/ui/app/components/app/dropdowns/simple-dropdown.js b/ui/app/components/app/dropdowns/simple-dropdown.js index bba088ed1..081674397 100644 --- a/ui/app/components/app/dropdowns/simple-dropdown.js +++ b/ui/app/components/app/dropdowns/simple-dropdown.js @@ -1,15 +1,18 @@ -const { Component } = require('react') -const PropTypes = require('prop-types') -const h = require('react-hyperscript') -const classnames = require('classnames') -const R = require('ramda') +import classnames from 'classnames' +import PropTypes from 'prop-types' +import React, { Component } from 'react' +import R from 'ramda' class SimpleDropdown extends Component { - constructor (props) { - super(props) - this.state = { - isOpen: false, - } + static propTypes = { + options: PropTypes.array.isRequired, + placeholder: PropTypes.string, + onSelect: PropTypes.func, + selectedOption: PropTypes.string, + } + + state = { + isOpen: false, } getDisplayValue () { @@ -26,67 +29,58 @@ class SimpleDropdown extends Component { } toggleOpen () { - const { isOpen } = this.state - this.setState({ isOpen: !isOpen }) + this.setState((prevState) => ({ + isOpen: !prevState.isOpen, + })) } renderOptions () { const { options, onSelect, selectedOption } = this.props - return h('div', [ - h('div.simple-dropdown__close-area', { - onClick: event => { - event.stopPropagation() - this.handleClose() - }, - }), - h('div.simple-dropdown__options', [ - ...options.map(option => { - return h( - 'div.simple-dropdown__option', - { - className: classnames({ + return ( +