Page MenuHomePhabricator

D8265.id28025.diff
No OneTemporary

D8265.id28025.diff

diff --git a/web/avatars/edit-user-avatar-menu.react.js b/web/avatars/edit-user-avatar-menu.react.js
--- a/web/avatars/edit-user-avatar-menu.react.js
+++ b/web/avatars/edit-user-avatar-menu.react.js
@@ -4,9 +4,11 @@
import * as React from 'react';
import { EditUserAvatarContext } from 'lib/components/base-edit-user-avatar-provider.react.js';
+import { useModalContext } from 'lib/components/modal-provider.react.js';
import SWMansionIcon from 'lib/components/SWMansionIcon.react.js';
import css from './edit-user-avatar-menu.css';
+import EmojiAvatarSelectionModal from './emoji-avatar-selection-modal.react.js';
import MenuItem from '../components/menu-item.react.js';
import Menu from '../components/menu.react.js';
@@ -27,9 +29,22 @@
[setUserAvatar],
);
+ const modalContext = useModalContext();
+
+ const openEmojiSelectionModal = React.useCallback(() => {
+ modalContext.pushModal(<EmojiAvatarSelectionModal />);
+ }, [modalContext]);
+
const emojiMenuItem = React.useMemo(
- () => <MenuItem key="emoji" text="Select emoji" icon="emote-smile" />,
- [],
+ () => (
+ <MenuItem
+ key="emoji"
+ text="Select emoji"
+ icon="emote-smile"
+ onClick={openEmojiSelectionModal}
+ />
+ ),
+ [openEmojiSelectionModal],
);
const imageMenuItem = React.useMemo(
() => <MenuItem key="image" text="Select image" icon="image-1" />,
diff --git a/web/avatars/emoji-avatar-selection-modal.react.js b/web/avatars/emoji-avatar-selection-modal.react.js
new file mode 100644
--- /dev/null
+++ b/web/avatars/emoji-avatar-selection-modal.react.js
@@ -0,0 +1,20 @@
+// @flow
+
+import * as React from 'react';
+
+import { useModalContext } from 'lib/components/modal-provider.react.js';
+
+import Modal from '../modals/modal.react.js';
+
+function EmojiAvatarSelectionModal(): React.Node {
+ const modalContext = useModalContext();
+ return (
+ <Modal
+ name="Emoji avatar selection"
+ size="large"
+ onClose={modalContext.popModal}
+ ></Modal>
+ );
+}
+
+export default EmojiAvatarSelectionModal;

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 26, 8:14 AM (9 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2704584
Default Alt Text
D8265.id28025.diff (2 KB)

Event Timeline