您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

OverflowToggleButton.js 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // @flow
  2. import { translate } from '../../../base/i18n';
  3. import { IconDotsHorizontal } from '../../../base/icons';
  4. import { AbstractButton, type AbstractButtonProps } from '../../../base/toolbox/components';
  5. /**
  6. * The type of the React {@code Component} props of {@link OverflowToggleButton}.
  7. */
  8. type Props = AbstractButtonProps & {
  9. /**
  10. * Whether the more options menu is open.
  11. */
  12. isOpen: boolean,
  13. /**
  14. * External handler for key down action.
  15. */
  16. onKeyDown: Function,
  17. };
  18. /**
  19. * Implementation of a button for toggling the overflow menu.
  20. */
  21. class OverflowToggleButton extends AbstractButton<Props, *> {
  22. accessibilityLabel = 'toolbar.accessibilityLabel.moreActions';
  23. toggledAccessibilityLabel = 'toolbar.accessibilityLabel.closeMoreActions';
  24. icon = IconDotsHorizontal;
  25. label = 'toolbar.moreActions';
  26. toggledLabel = 'toolbar.moreActions';
  27. tooltip = 'toolbar.moreActions';
  28. /**
  29. * Indicates whether this button is in toggled state or not.
  30. *
  31. * @override
  32. * @protected
  33. * @returns {boolean}
  34. */
  35. _isToggled() {
  36. return this.props.isOpen;
  37. }
  38. /**
  39. * Indicates whether a key was pressed.
  40. *
  41. * @override
  42. * @protected
  43. * @returns {boolean}
  44. */
  45. _onKeyDown() {
  46. this.props.onKeyDown();
  47. }
  48. }
  49. export default translate(OverflowToggleButton);