Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

HangupContextMenuItem.tsx 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. import React, { useCallback } from 'react';
  2. import Button from '../../../base/ui/components/web/Button';
  3. import { NOTIFY_CLICK_MODE } from '../../constants';
  4. /**
  5. * The type of the React {@code Component} props of {@link HangupContextMenuItem}.
  6. */
  7. type Props = {
  8. /**
  9. * Accessibility label for the button.
  10. */
  11. accessibilityLabel: string;
  12. /**
  13. * Key to use for toolbarButtonClicked event.
  14. */
  15. buttonKey: string;
  16. /**
  17. * Type of button to display.
  18. */
  19. buttonType: string;
  20. /**
  21. * Text associated with the button.
  22. */
  23. label: string;
  24. /**
  25. * Notify mode for `toolbarButtonClicked` event -
  26. * whether to only notify or to also prevent button click routine.
  27. */
  28. notifyMode?: string;
  29. /**
  30. * Callback that performs the actual hangup action.
  31. */
  32. onClick: Function;
  33. };
  34. declare let APP: any;
  35. /**
  36. * Implementation of a button to be rendered within Hangup context menu.
  37. *
  38. * @param {Object} props - Component's props.
  39. * @returns {JSX.Element} - Button that would trigger the hangup action.
  40. */
  41. export const HangupContextMenuItem = (props: Props) => {
  42. const shouldNotify = props.notifyMode !== undefined;
  43. const shouldPreventExecution = props.notifyMode === NOTIFY_CLICK_MODE.PREVENT_AND_NOTIFY;
  44. const _onClick = useCallback(() => {
  45. if (shouldNotify) {
  46. APP.API.notifyToolbarButtonClicked(props.buttonKey, shouldPreventExecution);
  47. }
  48. if (!shouldPreventExecution) {
  49. props.onClick();
  50. }
  51. }, []);
  52. return (
  53. <Button
  54. accessibilityLabel = { props.accessibilityLabel }
  55. fullWidth = { true }
  56. label = { props.label }
  57. onClick = { _onClick }
  58. type = { props.buttonType } />
  59. );
  60. };