2017-05-03 09:04:16 +09:00
|
|
|
import React from 'react';
|
2017-05-21 00:31:47 +09:00
|
|
|
import PropTypes from 'prop-types';
|
2016-08-31 23:15:12 +09:00
|
|
|
|
2017-06-24 02:36:54 +09:00
|
|
|
export default class ColumnHeader extends React.PureComponent {
|
2016-08-31 23:15:12 +09:00
|
|
|
|
2017-05-12 21:44:10 +09:00
|
|
|
static propTypes = {
|
|
|
|
icon: PropTypes.string,
|
|
|
|
type: PropTypes.string,
|
|
|
|
active: PropTypes.bool,
|
|
|
|
onClick: PropTypes.func,
|
|
|
|
hideOnMobile: PropTypes.bool,
|
2017-05-21 00:31:47 +09:00
|
|
|
columnHeaderId: PropTypes.string,
|
2017-05-12 21:44:10 +09:00
|
|
|
};
|
|
|
|
|
|
|
|
handleClick = () => {
|
2016-09-06 07:44:28 +09:00
|
|
|
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-23 00:30:35 +09:00
|
|
|
const { type, active, hideOnMobile, columnHeaderId } = this.props;
|
2017-02-21 08:10:49 +09:00
|
|
|
|
2016-09-06 07:44:28 +09:00
|
|
|
let icon = '';
|
|
|
|
|
|
|
|
if (this.props.icon) {
|
2017-04-23 11:26:55 +09:00
|
|
|
icon = <i className={`fa fa-fw fa-${this.props.icon} column-header__icon`} />;
|
2016-09-06 07:44:28 +09:00
|
|
|
}
|
|
|
|
|
2016-08-25 00:56:44 +09:00
|
|
|
return (
|
2017-04-23 00:30:35 +09: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 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
|
|
|
}
|