import React, { PropTypes, Component } from 'react'; import classnames from 'classnames'; import { SHOW_ALL, SHOW_MARKED, SHOW_UNMARKED } from '../constants/TodoFilters'; const FILTER_TITLES = { [SHOW_ALL]: 'All', [SHOW_UNMARKED]: 'Active', [SHOW_MARKED]: 'Completed' }; export default class Footer extends Component { static propTypes = { markedCount: PropTypes.number.isRequired, unmarkedCount: PropTypes.number.isRequired, filter: PropTypes.string.isRequired, onClearMarked: PropTypes.func.isRequired, onShow: PropTypes.func.isRequired } render() { return ( ); } renderTodoCount() { const { unmarkedCount } = this.props; const itemWord = unmarkedCount === 1 ? 'item' : 'items'; return ( {unmarkedCount || 'No'} {itemWord} left ); } renderFilterLink(filter) { const title = FILTER_TITLES[filter]; const { filter: selectedFilter, onShow } = this.props; return ( onShow(filter)}> {title} ); } renderClearButton() { const { markedCount, onClearMarked } = this.props; if (markedCount > 0) { return ( ); } } }