You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
794 B
36 lines
794 B
8 years ago
|
import React from 'react';
|
||
8 years ago
|
import PropTypes from 'prop-types';
|
||
8 years ago
|
|
||
8 years ago
|
export default class ColumnHeader extends React.PureComponent {
|
||
8 years ago
|
|
||
8 years ago
|
static propTypes = {
|
||
|
icon: PropTypes.string,
|
||
|
type: PropTypes.string,
|
||
|
active: PropTypes.bool,
|
||
|
onClick: PropTypes.func,
|
||
8 years ago
|
columnHeaderId: PropTypes.string,
|
||
8 years ago
|
};
|
||
|
|
||
|
handleClick = () => {
|
||
8 years ago
|
this.props.onClick();
|
||
8 years ago
|
}
|
||
8 years ago
|
|
||
8 years ago
|
render () {
|
||
7 years ago
|
const { type, active, columnHeaderId } = this.props;
|
||
8 years ago
|
|
||
8 years ago
|
let icon = '';
|
||
|
|
||
|
if (this.props.icon) {
|
||
8 years ago
|
icon = <i className={`fa fa-fw fa-${this.props.icon} column-header__icon`} />;
|
||
8 years ago
|
}
|
||
|
|
||
8 years ago
|
return (
|
||
7 years ago
|
<div role='heading' tabIndex='0' className={`column-header ${active ? 'active' : ''}`} onClick={this.handleClick} id={columnHeaderId || null}>
|
||
8 years ago
|
{icon}
|
||
8 years ago
|
{type}
|
||
8 years ago
|
</div>
|
||
|
);
|
||
|
}
|
||
8 years ago
|
|
||
8 years ago
|
}
|