import React from 'react' import PropTypes from 'prop-types' import { connect } from 'react-redux' import { deleteDeckColumnAtIndex } from '../actions/deck' import Icon from './icon' import Text from './text' import Button from './button' class DeckColumnHeader extends React.PureComponent { handleClickDelete = () => { this.props.dispatch(deleteDeckColumnAtIndex(this.props.index)) } handleClickRefresh = () => { const { onRefresh } = this.props if (!!onRefresh) onRefresh() } render() { const { title, subtitle, icon, children, noButtons, noRefresh, } = this.props return (
{ !!icon && }
{ !!title && {title} } { !!subtitle && {subtitle} }
{ !!title && !noButtons &&
{ !noRefresh &&
}
) } } DeckColumnHeader.propTypes = { title: PropTypes.string, subtitle: PropTypes.string, icon: PropTypes.string, index: PropTypes.number, noButtons: PropTypes.bool, noRefresh: PropTypes.bool, onRefresh: PropTypes.func, } export default connect()(DeckColumnHeader)