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