Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

HangupToggleButton.tsx 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // @ts-ignore
  2. import { translate } from '../../../base/i18n';
  3. import { IconCloseLarge, IconHangup } from '../../../base/icons/svg';
  4. // eslint-disable-next-line lines-around-comment
  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. tooltip = 'toolbar.hangup';
  30. props: Props;
  31. /**
  32. * Indicates whether this button is in toggled state or not.
  33. *
  34. * @override
  35. * @protected
  36. * @returns {boolean}
  37. */
  38. _isToggled() {
  39. return this.props.isOpen;
  40. }
  41. /**
  42. * Indicates whether a key was pressed.
  43. *
  44. * @override
  45. * @protected
  46. * @returns {boolean}
  47. */
  48. _onKeyDown() {
  49. this.props.onKeyDown();
  50. }
  51. }
  52. export default translate(HangupToggleButton);