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