Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

OverflowMenuButton.ts 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import { connect } from 'react-redux';
  2. import { IReduxState } from '../../../app/types';
  3. import { openSheet } from '../../../base/dialog/actions';
  4. import { OVERFLOW_MENU_ENABLED } from '../../../base/flags/constants';
  5. import { getFeatureFlag } from '../../../base/flags/functions';
  6. import { translate } from '../../../base/i18n/functions';
  7. import { IconDotsHorizontal } from '../../../base/icons/svg';
  8. import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
  9. import OverflowMenu from './OverflowMenu';
  10. /**
  11. * An implementation of a button for showing the {@code OverflowMenu}.
  12. */
  13. class OverflowMenuButton extends AbstractButton<AbstractButtonProps> {
  14. accessibilityLabel = 'toolbar.accessibilityLabel.moreActions';
  15. icon = IconDotsHorizontal;
  16. label = 'toolbar.moreActions';
  17. /**
  18. * Handles clicking / pressing this {@code OverflowMenuButton}.
  19. *
  20. * @protected
  21. * @returns {void}
  22. */
  23. _handleClick() {
  24. // @ts-ignore
  25. this.props.dispatch(openSheet(OverflowMenu));
  26. }
  27. }
  28. /**
  29. * Maps (parts of) the redux state to the associated props for the
  30. * {@code OverflowMenuButton} component.
  31. *
  32. * @param {Object} state - The Redux state.
  33. * @private
  34. * @returns {Props}
  35. */
  36. function _mapStateToProps(state: IReduxState) {
  37. const enabledFlag = getFeatureFlag(state, OVERFLOW_MENU_ENABLED, true);
  38. return {
  39. visible: enabledFlag
  40. };
  41. }
  42. export default translate(connect(_mapStateToProps)(OverflowMenuButton));