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.

HangupToggleButton.tsx 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import { connect } from 'react-redux';
  2. import { translate } from '../../../base/i18n/functions';
  3. import { IconCloseLarge, IconHangup } from '../../../base/icons/svg';
  4. import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
  5. /**
  6. * The type of the React {@code Component} props of {@link HangupToggleButton}.
  7. */
  8. interface IProps extends 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 hangup menu.
  20. */
  21. class HangupToggleButton extends AbstractButton<IProps> {
  22. accessibilityLabel = 'toolbar.accessibilityLabel.hangup';
  23. icon = IconHangup;
  24. label = 'toolbar.hangup';
  25. toggledIcon = IconCloseLarge;
  26. toggledLabel = 'toolbar.hangup';
  27. tooltip = 'toolbar.hangup';
  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 connect()(translate(HangupToggleButton));