diff --git a/components/dropdown.js b/components/dropdown.js index e60bb75..374a953 100644 --- a/components/dropdown.js +++ b/components/dropdown.js @@ -1,7 +1,8 @@ import React from 'react' +import enhanceWithClickOutside from 'react-click-outside' import ArrowDown from './arrowdown' -export default class extends React.Component { +class Dropdown extends React.Component { constructor(props) { super() this.state = { @@ -20,6 +21,10 @@ export default class extends React.Component { this.setState({ listVisible: !this.state.listVisible }) } + handleClickOutside() { + this.setState({ listVisible: false }); + } + renderListItems() { return this.props.list.map((item, i) => (