2017-05-03 01:04:16 +01:00
|
|
|
import React from 'react';
|
2017-05-20 16:31:47 +01:00
|
|
|
import PropTypes from 'prop-types';
|
2018-01-24 03:03:51 +00:00
|
|
|
import classNames from 'classnames';
|
2016-08-31 15:15:12 +01:00
|
|
|
|
2017-06-23 18:36:54 +01:00
|
|
|
export default class ColumnHeader extends React.PureComponent {
|
2016-08-31 15:15:12 +01:00
|
|
|
|
2017-05-12 13:44:10 +01:00
|
|
|
static propTypes = {
|
|
|
|
icon: PropTypes.string,
|
|
|
|
type: PropTypes.string,
|
|
|
|
active: PropTypes.bool,
|
|
|
|
onClick: PropTypes.func,
|
2017-05-20 16:31:47 +01:00
|
|
|
columnHeaderId: PropTypes.string,
|
2017-05-12 13:44:10 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
handleClick = () => {
|
2016-09-05 23:44:28 +01:00
|
|
|
this.props.onClick();
|
2017-04-21 19:05:35 +01:00
|
|
|
}
|
2016-09-05 23:44:28 +01:00
|
|
|
|
2016-08-31 15:15:12 +01:00
|
|
|
render () {
|
2018-01-24 03:03:51 +00:00
|
|
|
const { icon, type, active, columnHeaderId } = this.props;
|
|
|
|
let iconElement = '';
|
2017-02-20 23:10:49 +00:00
|
|
|
|
2018-01-24 03:03:51 +00:00
|
|
|
if (icon) {
|
2018-09-27 16:08:56 +01:00
|
|
|
iconElement = <i className={`fas fa-fw fa-${icon} column-header__icon`} />;
|
2016-09-05 23:44:28 +01:00
|
|
|
}
|
|
|
|
|
2016-08-24 16:56:44 +01:00
|
|
|
return (
|
2018-01-24 03:03:51 +00:00
|
|
|
<h1 className={classNames('column-header', { active })} id={columnHeaderId || null}>
|
|
|
|
<button onClick={this.handleClick}>
|
|
|
|
{iconElement}
|
|
|
|
{type}
|
|
|
|
</button>
|
|
|
|
</h1>
|
2016-08-24 16:56:44 +01:00
|
|
|
);
|
|
|
|
}
|
2016-08-31 15:15:12 +01:00
|
|
|
|
2017-04-21 19:05:35 +01:00
|
|
|
}
|