您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

ReactionsMenuPopup.js 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // @flow
  2. import InlineDialog from '@atlaskit/inline-dialog';
  3. import React, { useCallback } from 'react';
  4. import { useDispatch, useSelector } from 'react-redux';
  5. import { toggleReactionsMenuVisibility } from '../../actions.web';
  6. import { getReactionsMenuVisibility } from '../../functions.web';
  7. import ReactionsMenu from './ReactionsMenu';
  8. type Props = {
  9. /**
  10. * Component's children (the reactions menu button).
  11. */
  12. children: React$Node
  13. }
  14. /**
  15. * Popup with reactions menu.
  16. *
  17. * @returns {ReactElement}
  18. */
  19. function ReactionsMenuPopup({
  20. children
  21. }: Props) {
  22. /**
  23. * Flag controlling the visibility of the popup.
  24. */
  25. const isOpen = useSelector(state => getReactionsMenuVisibility(state));
  26. const dispatch = useDispatch();
  27. const onClose = useCallback(() => {
  28. dispatch(toggleReactionsMenuVisibility());
  29. });
  30. return (
  31. <div className = 'reactions-menu-popup'>
  32. <InlineDialog
  33. content = { <ReactionsMenu /> }
  34. isOpen = { isOpen }
  35. onClose = { onClose }
  36. placement = 'top'>
  37. {children}
  38. </InlineDialog>
  39. </div>
  40. );
  41. }
  42. export default ReactionsMenuPopup;