2017-05-02 20:04:16 -04:00
|
|
|
import React from 'react';
|
2017-05-20 11:31:47 -04:00
|
|
|
import PropTypes from 'prop-types';
|
2016-08-31 10:15:12 -04:00
|
|
|
|
2017-06-23 13:36:54 -04:00
|
|
|
export default class ColumnHeader extends React.PureComponent {
|
2016-08-31 10:15:12 -04:00
|
|
|
|
2017-05-12 08:44:10 -04:00
|
|
|
static propTypes = {
|
|
|
|
icon: PropTypes.string,
|
|
|
|
type: PropTypes.string,
|
|
|
|
active: PropTypes.bool,
|
|
|
|
onClick: PropTypes.func,
|
|
|
|
hideOnMobile: PropTypes.bool,
|
2017-05-20 11:31:47 -04:00
|
|
|
columnHeaderId: PropTypes.string,
|
2017-05-12 08:44:10 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
handleClick = () => {
|
2016-09-05 18:44:28 -04:00
|
|
|
this.props.onClick();
|
2017-04-21 14:05:35 -04:00
|
|
|
}
|
2016-09-05 18:44:28 -04:00
|
|
|
|
2016-08-31 10:15:12 -04:00
|
|
|
render () {
|
2017-04-22 11:30:35 -04:00
|
|
|
const { type, active, hideOnMobile, columnHeaderId } = this.props;
|
2017-02-20 18:10:49 -05:00
|
|
|
|
2016-09-05 18:44:28 -04:00
|
|
|
let icon = '';
|
|
|
|
|
|
|
|
if (this.props.icon) {
|
2017-04-22 22:26:55 -04:00
|
|
|
icon = <i className={`fa fa-fw fa-${this.props.icon} column-header__icon`} />;
|
2016-09-05 18:44:28 -04:00
|
|
|
}
|
|
|
|
|
2016-08-24 11:56:44 -04:00
|
|
|
return (
|
2017-04-22 11:30:35 -04:00
|
|
|
<div role='button heading' tabIndex='0' className={`column-header ${active ? 'active' : ''} ${hideOnMobile ? 'hidden-on-mobile' : ''}`} onClick={this.handleClick} id={columnHeaderId || null}>
|
2016-09-05 18:44:28 -04:00
|
|
|
{icon}
|
2017-02-20 18:10:49 -05:00
|
|
|
{type}
|
2016-08-24 11:56:44 -04:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2016-08-31 10:15:12 -04:00
|
|
|
|
2017-04-21 14:05:35 -04:00
|
|
|
}
|