import classnames from 'classnames'; import CSSTransitionGroup from 'react-addons-css-transition-group'; import React from 'react'; const methodsToBind = [ 'getDropdownButton', 'getDropdownMenu', 'handleDropdownBlur', 'handleDropdownClick', 'handleDropdownFocus', 'handleItemSelect' ]; export default class Dropdown extends React.Component { constructor() { super(); this.state = { isExpanded: false }; methodsToBind.forEach((method) => { this[method] = this[method].bind(this); }); } handleDropdownBlur() { this.setState({ isExpanded: false }); } handleDropdownClick() { if (this.state.isExpanded) { this.refs.dropdown.blur(); } else { this.refs.dropdown.focus(); } } handleDropdownFocus(event) { this.setState({ isExpanded: true }); } handleItemSelect(item) { this.refs.dropdown.blur(); this.props.handleItemSelect(item); } getDropdownButton() { return (