Page MenuHomePhabricator

D8243.id27853.diff
No OneTemporary

D8243.id27853.diff

diff --git a/web/avatars/edit-user-avatar-menu.react.js b/web/avatars/edit-user-avatar-menu.react.js
new file mode 100644
--- /dev/null
+++ b/web/avatars/edit-user-avatar-menu.react.js
@@ -0,0 +1,37 @@
+// @flow
+
+import * as React from 'react';
+
+import SWMansionIcon from 'lib/components/SWMansionIcon.react.js';
+
+import MenuItem from '../components/menu-item.react.js';
+import Menu from '../components/menu.react.js';
+
+function EditUserAvatarMenu(): React.Node {
+ const emojiMenuItem = React.useMemo(
+ () => <MenuItem key="emoji" text="Select emoji" icon="emote-smile" />,
+ [],
+ );
+ const imageMenuItem = React.useMemo(
+ () => <MenuItem key="image" text="Select image" icon="image-1" />,
+ [],
+ );
+ const removeMenuItem = React.useMemo(
+ () => <MenuItem key="remove" text="Reset to default" icon="trash-2" />,
+ [],
+ );
+
+ const menuItems = React.useMemo(
+ () => [emojiMenuItem, imageMenuItem, removeMenuItem],
+ [emojiMenuItem, imageMenuItem, removeMenuItem],
+ );
+
+ const editIcon = React.useMemo(
+ () => <SWMansionIcon icon="edit-2" size={20} />,
+ [],
+ );
+
+ return <Menu icon={editIcon}>{menuItems}</Menu>;
+}
+
+export default EditUserAvatarMenu;
diff --git a/web/avatars/edit-user-avatar.react.js b/web/avatars/edit-user-avatar.react.js
--- a/web/avatars/edit-user-avatar.react.js
+++ b/web/avatars/edit-user-avatar.react.js
@@ -2,8 +2,7 @@
import * as React from 'react';
-import SWMansionIcon from 'lib/components/SWMansionIcon.react.js';
-
+import EditUserAvatarMenu from './edit-user-avatar-menu.react.js';
import css from './edit-user-avatar.css';
import UserAvatar from './user-avatar.react.js';
@@ -13,11 +12,12 @@
};
function EditUserAvatar(props: Props): React.Node {
const { userID } = props;
+
return (
<div className={css.editUserAvatarContainer}>
<UserAvatar userID={userID} size="profile" />
<div className={css.editAvatarBadge}>
- <SWMansionIcon icon="edit-2" size={20} />
+ <EditUserAvatarMenu />
</div>
</div>
);

File Metadata

Mime Type
text/plain
Expires
Sat, Jan 11, 12:09 AM (19 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2856889
Default Alt Text
D8243.id27853.diff (2 KB)

Event Timeline