logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

column_header.js (842B)


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