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

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