import React from "react"; import { formatFilterNumber } from "../lib/helpers"; export default class Filters extends React.Component { onCloseClick(e) { if (this.props.onClose) { this.props.onClose(); } } onMaxPriceChange(e) { this.props.dispatch({ type: "SET_MAX_PRICE", action: { maxPrice: e.target.value } }); } onMinPriceChange(e) { this.props.dispatch({ type: "SET_MIN_PRICE", action: { minPrice: e.target.value } }); } onMaxSizeChange(e) { this.props.dispatch({ type: "SET_MAX_SIZE", action: { maxSize: e.target.value } }); } onMinSizeChange(e) { this.props.dispatch({ type: "SET_MIN_SIZE", action: { minSize: e.target.value } }); } onRoomsClick(rooms) { this.props.dispatch({type: 'SET_ROOMS', action: {rooms}}); } onRefreshClick() { this.updateSearch(); } onKeyPress (e) { if (e.key === 'Enter') { this.updateSearch(); } } updateSearch () { this.props.dispatch({ type: "UPDATE_SEARCH" }); } render() { const { filters } = this.props; const selectedRooms = val => filters.rooms[val] ? "selected" : ""; return (