logo

mastofe

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

text_icon_button.js (734B)


  1. import React from 'react';
  2. import PropTypes from 'prop-types';
  3. export default class TextIconButton extends React.PureComponent {
  4. static propTypes = {
  5. label: PropTypes.string.isRequired,
  6. title: PropTypes.string,
  7. active: PropTypes.bool,
  8. onClick: PropTypes.func.isRequired,
  9. ariaControls: PropTypes.string,
  10. };
  11. handleClick = (e) => {
  12. e.preventDefault();
  13. this.props.onClick();
  14. }
  15. render () {
  16. const { label, title, active, ariaControls } = this.props;
  17. return (
  18. <button title={title} aria-label={title} className={`text-icon-button ${active ? 'active' : ''}`} aria-expanded={active} onClick={this.handleClick} aria-controls={ariaControls}>
  19. {label}
  20. </button>
  21. );
  22. }
  23. }