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.

41 lines
945 B

  1. import PropTypes from 'prop-types'
  2. class ColumnHeader extends React.PureComponent {
  3. constructor (props, context) {
  4. super(props, context);
  5. this.handleClick = this.handleClick.bind(this);
  6. }
  7. handleClick () {
  8. this.props.onClick();
  9. }
  10. render () {
  11. const { type, active, hideOnMobile } = this.props;
  12. let icon = '';
  13. if (this.props.icon) {
  14. icon = <i className={`fa fa-fw fa-${this.props.icon}`} style={{ display: 'inline-block', marginRight: '5px' }} />;
  15. }
  16. return (
  17. <div role='button' tabIndex='0' aria-label={type} className={`column-header ${active ? 'active' : ''} ${hideOnMobile ? 'hidden-on-mobile' : ''}`} onClick={this.handleClick}>
  18. {icon}
  19. {type}
  20. </div>
  21. );
  22. }
  23. }
  24. ColumnHeader.propTypes = {
  25. icon: PropTypes.string,
  26. type: PropTypes.string,
  27. active: PropTypes.bool,
  28. onClick: PropTypes.func,
  29. hideOnMobile: PropTypes.bool
  30. };
  31. export default ColumnHeader;