闭社主体 forked from https://github.com/tootsuite/mastodon
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.

43 lines
1006 B

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