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.

35 lines
801 B

  1. import React from 'react';
  2. import PropTypes from 'prop-types';
  3. export default class ColumnHeader extends React.PureComponent {
  4. static propTypes = {
  5. icon: PropTypes.string,
  6. type: PropTypes.string,
  7. active: PropTypes.bool,
  8. onClick: PropTypes.func,
  9. columnHeaderId: PropTypes.string,
  10. };
  11. handleClick = () => {
  12. this.props.onClick();
  13. }
  14. render () {
  15. const { type, active, columnHeaderId } = this.props;
  16. let icon = '';
  17. if (this.props.icon) {
  18. icon = <i className={`fa fa-fw fa-${this.props.icon} column-header__icon`} />;
  19. }
  20. return (
  21. <div role='button heading' tabIndex='0' className={`column-header ${active ? 'active' : ''}`} onClick={this.handleClick} id={columnHeaderId || null}>
  22. {icon}
  23. {type}
  24. </div>
  25. );
  26. }
  27. }