2017-04-22 03:05:35 +09:00
|
|
|
import PropTypes from 'prop-types'
|
2016-08-31 23:15:12 +09:00
|
|
|
|
2017-04-22 03:05:35 +09:00
|
|
|
class ColumnHeader extends React.PureComponent {
|
2016-08-31 23:15:12 +09:00
|
|
|
|
2017-04-22 03:05:35 +09:00
|
|
|
constructor (props, context) {
|
|
|
|
super(props, context);
|
|
|
|
this.handleClick = this.handleClick.bind(this);
|
|
|
|
}
|
2016-08-31 23:15:12 +09:00
|
|
|
|
2016-09-06 07:44:28 +09:00
|
|
|
handleClick () {
|
|
|
|
this.props.onClick();
|
2017-04-22 03:05:35 +09:00
|
|
|
}
|
2016-09-06 07:44:28 +09:00
|
|
|
|
2016-08-31 23:15:12 +09:00
|
|
|
render () {
|
2017-04-22 01:17:55 +09:00
|
|
|
const { type, active, hideOnMobile } = this.props;
|
2017-02-21 08:10:49 +09:00
|
|
|
|
2016-09-06 07:44:28 +09:00
|
|
|
let icon = '';
|
|
|
|
|
|
|
|
if (this.props.icon) {
|
|
|
|
icon = <i className={`fa fa-fw fa-${this.props.icon}`} style={{ display: 'inline-block', marginRight: '5px' }} />;
|
|
|
|
}
|
|
|
|
|
2016-08-25 00:56:44 +09:00
|
|
|
return (
|
2017-04-22 01:17:55 +09:00
|
|
|
<div role='button' tabIndex='0' aria-label={type} className={`column-header ${active ? 'active' : ''} ${hideOnMobile ? 'hidden-on-mobile' : ''}`} onClick={this.handleClick}>
|
2016-09-06 07:44:28 +09:00
|
|
|
{icon}
|
2017-02-21 08:10:49 +09:00
|
|
|
{type}
|
2016-08-25 00:56:44 +09:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2016-08-31 23:15:12 +09:00
|
|
|
|
2017-04-22 03:05:35 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
ColumnHeader.propTypes = {
|
|
|
|
icon: PropTypes.string,
|
|
|
|
type: PropTypes.string,
|
|
|
|
active: PropTypes.bool,
|
|
|
|
onClick: PropTypes.func,
|
|
|
|
hideOnMobile: PropTypes.bool
|
|
|
|
};
|
2016-08-25 00:56:44 +09:00
|
|
|
|
|
|
|
export default ColumnHeader;
|