Skip to content

Commit

Permalink
[web] Split EmojiAvatarSelectionModal into "Emoji" and "Color" tab
Browse files Browse the repository at this point in the history
Summary:
Separate Emoji and Color into separate tabs.

NOTE: Layout/Styling will be handled separately.

WARNING: Took some liberties here with styling to unblock myself since emoji selection part of this modal wasn't part of designs (https://blob.sh/84e83d.png). Kept things as simple as possible, happy to iterate on this further. (cc @Ashoat, @ted)

---

Depends on D8286

Test Plan:
Looks (and continues to work) as expected:

{F600972}

Reviewers: ashoat, ginsu, rohan

Reviewed By: ginsu

Subscribers: tomek, ashoat, ted

Differential Revision: https://phab.comm.dev/D8287
  • Loading branch information
atulsmadhugiri committed Jun 23, 2023
1 parent ce4888d commit debbfe6
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 21 deletions.
5 changes: 4 additions & 1 deletion web/avatars/emoji-avatar-selection-modal.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
div.modalBody {
div.modalContainer {
display: flex;
flex-direction: column;
overflow: hidden;
}

div.modalBody {
padding: 20px;
}

Expand Down
53 changes: 33 additions & 20 deletions web/avatars/emoji-avatar-selection-modal.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@ import type {
import Avatar from './avatar.react.js';
import css from './emoji-avatar-selection-modal.css';
import Button, { buttonThemes } from '../components/button.react.js';
import Tabs from '../components/tabs.react.js';
import LoadingIndicator from '../loading-indicator.react.js';
import Modal from '../modals/modal.react.js';
import ColorSelector from '../modals/threads/color-selector.react.js';
import { useSelector } from '../redux/redux-utils.js';

type TabType = 'emoji' | 'color';

function EmojiAvatarSelectionModal(): React.Node {
const { popModal } = useModalContext();

Expand Down Expand Up @@ -110,36 +113,46 @@ function EmojiAvatarSelectionModal(): React.Node {
saveButtonContent = 'Save Avatar';
}

const [currentTabType, setCurrentTabType] = React.useState<TabType>('emoji');

return (
<Modal name="Emoji avatar selection" size="large" onClose={popModal}>
<div className={css.modalBody}>
<div className={css.modalContainer}>
<div className={css.avatarContainer}>
<Avatar
avatarInfo={pendingEmojiAvatar}
size="profile"
showSpinner={userAvatarSaveInProgress}
/>
</div>
<div className={css.emojiPickerContainer}>
<Picker data={data} theme="dark" onEmojiSelect={onEmojiSelect} />
</div>
<div className={css.colorSelectorContainer}>
<ColorSelector
currentColor={pendingAvatarColor}
onColorSelection={onColorSelection}
/>
</div>
<div className={css.saveButtonContainer}>
<Button
variant="filled"
buttonColor={buttonColor}
onClick={onSaveAvatar}
disabled={userAvatarSaveInProgress}
>
<div className={css.saveAvatarButtonContent}>
{saveButtonContent}
<Tabs.Container activeTab={currentTabType} setTab={setCurrentTabType}>
<Tabs.Item id="emoji" header="Emoji">
<div className={css.emojiPickerContainer}>
<Picker data={data} theme="dark" onEmojiSelect={onEmojiSelect} />
</div>
</Tabs.Item>
<Tabs.Item id="color" header="Color">
<div className={css.colorSelectorContainer}>
<ColorSelector
currentColor={pendingAvatarColor}
onColorSelection={onColorSelection}
/>
</div>
</Button>
</Tabs.Item>
</Tabs.Container>
<div className={css.modalBody}>
<div className={css.saveButtonContainer}>
<Button
variant="filled"
buttonColor={buttonColor}
onClick={onSaveAvatar}
disabled={userAvatarSaveInProgress}
>
<div className={css.saveAvatarButtonContent}>
{saveButtonContent}
</div>
</Button>
</div>
</div>
</div>
</Modal>
Expand Down

0 comments on commit debbfe6

Please sign in to comment.