Skip to content

Commit

Permalink
Merge pull request ChatGPTNextWeb#4234 from fengzai6/main
Browse files Browse the repository at this point in the history
Fix EmojiPicker mobile width adaptation and update avatar clicking behavior
  • Loading branch information
fred-bf authored Mar 11, 2024
2 parents ff9f0e6 + ad10a11 commit a15c4d9
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
1 change: 1 addition & 0 deletions app/components/emoji.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export function AvatarPicker(props: {
}) {
return (
<EmojiPicker
width={"100%"}
lazyLoadEmojis
theme={EmojiTheme.AUTO}
getEmojiUrl={getEmojiUrl}
Expand Down
2 changes: 2 additions & 0 deletions app/components/settings.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

.avatar {
cursor: pointer;
position: relative;
z-index: 1;
}

.edit-prompt-modal {
Expand Down
4 changes: 3 additions & 1 deletion app/components/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,9 @@ export function Settings() {
>
<div
className={styles.avatar}
onClick={() => setShowEmojiPicker(true)}
onClick={() => {
setShowEmojiPicker(!showEmojiPicker);
}}
>
<Avatar avatar={config.avatar} />
</div>
Expand Down
9 changes: 8 additions & 1 deletion app/components/ui-lib.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,24 @@

.popover-content {
position: absolute;
width: 350px;
animation: slide-in 0.3s ease;
right: 0;
top: calc(100% + 10px);
}

@media screen and (max-width: 600px) {
.popover-content {
width: auto;
}
}
.popover-mask {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background-color: rgba(0, 0, 0, 0.3);
backdrop-filter: blur(5px);
}

.list-item {
Expand Down
8 changes: 4 additions & 4 deletions app/components/ui-lib.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ export function Popover(props: {
<div className={styles.popover}>
{props.children}
{props.open && (
<div className={styles["popover-content"]}>
<div className={styles["popover-mask"]} onClick={props.onClose}></div>
{props.content}
</div>
<div className={styles["popover-mask"]} onClick={props.onClose}></div>
)}
{props.open && (
<div className={styles["popover-content"]}>{props.content}</div>
)}
</div>
);
Expand Down

0 comments on commit a15c4d9

Please sign in to comment.