import React, { PropTypes } from 'react'; import { connect } from 'react-redux'; import PureComponent from 'react-pure-render/component'; import { InputGroup, FormControl, Button, Row } from 'react-bootstrap'; import classnames from 'classnames'; import { clearFilter, updateFilter } from '../../redux/actions'; const ESC = 27; const clearIcon = ; const searchIcon = ; const bindableActions = { clearFilter, updateFilter }; const mapStateToProps = state => ({ filter: state.challengesApp.filter }); export class Header extends PureComponent { constructor(...props) { super(...props); this.handleKeyDown = this.handleKeyDown.bind(this); } static displayName = 'MapHeader'; static propTypes = { clearFilter: PropTypes.func, filter: PropTypes.string, updateFilter: PropTypes.func }; handleKeyDown(e) { if (e.keyCode === ESC) { this.props.clearFilter(); } } renderSearchAddon(filter, clearFilter) { if (!filter) { return searchIcon; } return { clearIcon }; } render() { const { updateFilter, clearFilter, filter } = this.props; const inputClass = classnames({ 'map-filter': true, filled: !!filter }); return (
Challenges required for certifications are marked with a *