闭社主体 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.

36 lines
891 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. hideOnMobile: PropTypes.bool,
  10. columnHeaderId: PropTypes.string,
  11. };
  12. handleClick = () => {
  13. this.props.onClick();
  14. }
  15. render () {
  16. const { type, active, hideOnMobile, columnHeaderId } = this.props;
  17. let icon = '';
  18. if (this.props.icon) {
  19. icon = <i className={`fa fa-fw fa-${this.props.icon} column-header__icon`} />;
  20. }
  21. return (
  22. <div role='button heading' tabIndex='0' className={`column-header ${active ? 'active' : ''} ${hideOnMobile ? 'hidden-on-mobile' : ''}`} onClick={this.handleClick} id={columnHeaderId || null}>
  23. {icon}
  24. {type}
  25. </div>
  26. );
  27. }
  28. }