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.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /* eslint-disable lines-around-comment */
  2. // @ts-ignore
  3. import { translate } from '../../../base/i18n';
  4. // @ts-ignore
  5. import { IconClose, IconHangup } from '../../../base/icons';
  6. // @ts-ignore
  7. import { AbstractButton, type AbstractButtonProps } from '../../../base/toolbox/components';
  8. /**
  9. * The type of the React {@code Component} props of {@link HangupToggleButton}.
  10. */
  11. type Props = AbstractButtonProps & {
  12. /**
  13. * Whether the more options menu is open.
  14. */
  15. isOpen: boolean,
  16. /**
  17. * External handler for key down action.
  18. */
  19. onKeyDown: Function,
  20. };
  21. /**
  22. * Implementation of a button for toggling the hangup menu.
  23. */
  24. class HangupToggleButton extends AbstractButton<Props, any, any> {
  25. accessibilityLabel = 'toolbar.accessibilityLabel.hangup';
  26. icon = IconHangup;
  27. label = 'toolbar.hangup';
  28. toggledIcon = IconClose;
  29. toggledLabel = 'toolbar.hangup';
  30. props: Props;
  31. /**
  32. * Retrieves tooltip dynamically.
  33. */
  34. get tooltip() {
  35. return 'toolbar.hangup';
  36. }
  37. /**
  38. * Required by linter due to AbstractButton overwritten prop being writable.
  39. *
  40. * @param {string} _value - The value.
  41. */
  42. set tooltip(_value) {
  43. // Unused.
  44. }
  45. /**
  46. * Indicates whether this button is in toggled state or not.
  47. *
  48. * @override
  49. * @protected
  50. * @returns {boolean}
  51. */
  52. _isToggled() {
  53. return this.props.isOpen;
  54. }
  55. /**
  56. * Indicates whether a key was pressed.
  57. *
  58. * @override
  59. * @protected
  60. * @returns {boolean}
  61. */
  62. _onKeyDown() {
  63. this.props.onKeyDown();
  64. }
  65. }
  66. export default translate(HangupToggleButton);