|
|
@ -1,7 +1,8 @@
|
|
|
|
import React from 'react'
|
|
|
|
import React from 'react'
|
|
|
|
|
|
|
|
import enhanceWithClickOutside from 'react-click-outside'
|
|
|
|
import ArrowDown from './arrowdown'
|
|
|
|
import ArrowDown from './arrowdown'
|
|
|
|
|
|
|
|
|
|
|
|
export default class extends React.Component {
|
|
|
|
class Dropdown extends React.Component {
|
|
|
|
constructor(props) {
|
|
|
|
constructor(props) {
|
|
|
|
super()
|
|
|
|
super()
|
|
|
|
this.state = {
|
|
|
|
this.state = {
|
|
|
@ -20,6 +21,10 @@ export default class extends React.Component {
|
|
|
|
this.setState({ listVisible: !this.state.listVisible })
|
|
|
|
this.setState({ listVisible: !this.state.listVisible })
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
handleClickOutside() {
|
|
|
|
|
|
|
|
this.setState({ listVisible: false });
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
renderListItems() {
|
|
|
|
renderListItems() {
|
|
|
|
return this.props.list.map((item, i) => (
|
|
|
|
return this.props.list.map((item, i) => (
|
|
|
|
<div className={`dropdown-list-item ${this.state.selected === item ? "selected" : ""}`} key={i} onClick={this.select.bind(null, item)}>
|
|
|
|
<div className={`dropdown-list-item ${this.state.selected === item ? "selected" : ""}`} key={i} onClick={this.select.bind(null, item)}>
|
|
|
@ -118,3 +123,5 @@ export default class extends React.Component {
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default enhanceWithClickOutside(Dropdown)
|
|
|
|