import React from 'react' import enhanceWithClickOutside from 'react-click-outside' import ArrowDown from './svg/Arrowdown' import { PALETTE } from '../lib/constants' class Dropdown extends React.Component { constructor(props) { super() this.state = { isVisible: false, selected: props.selected || props.list[0] } this.select = this.select.bind(this) this.toggle = this.toggle.bind(this) } select(item) { if (this.state.selected !== item) { this.props.onChange(item) this.setState({ selected: item }) } } toggle() { this.setState({ isVisible: !this.state.isVisible }) } handleClickOutside() { this.setState({ isVisible: false }); } renderListItems() { return this.props.list.map((item, i) => (