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.
44 lines
1006 B
44 lines
1006 B
8 years ago
|
import React from 'react';
|
||
8 years ago
|
import PropTypes from 'prop-types'
|
||
8 years ago
|
|
||
8 years ago
|
class ColumnHeader extends React.PureComponent {
|
||
8 years ago
|
|
||
8 years ago
|
constructor (props, context) {
|
||
|
super(props, context);
|
||
|
this.handleClick = this.handleClick.bind(this);
|
||
|
}
|
||
8 years ago
|
|
||
8 years ago
|
handleClick () {
|
||
|
this.props.onClick();
|
||
8 years ago
|
}
|
||
8 years ago
|
|
||
8 years ago
|
render () {
|
||
8 years ago
|
const { type, active, hideOnMobile, 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 (
|
||
8 years ago
|
<div role='button heading' tabIndex='0' className={`column-header ${active ? 'active' : ''} ${hideOnMobile ? 'hidden-on-mobile' : ''}`} onClick={this.handleClick} id={columnHeaderId || null}>
|
||
8 years ago
|
{icon}
|
||
8 years ago
|
{type}
|
||
8 years ago
|
</div>
|
||
|
);
|
||
|
}
|
||
8 years ago
|
|
||
8 years ago
|
}
|
||
|
|
||
|
ColumnHeader.propTypes = {
|
||
|
icon: PropTypes.string,
|
||
|
type: PropTypes.string,
|
||
|
active: PropTypes.bool,
|
||
|
onClick: PropTypes.func,
|
||
8 years ago
|
hideOnMobile: PropTypes.bool,
|
||
|
columnHeaderId: PropTypes.string
|
||
8 years ago
|
};
|
||
8 years ago
|
|
||
|
export default ColumnHeader;
|