Skip to content

Commit 9d3c1eb

Browse files
olaurendeauAntoLC
authored andcommitted
🐛(frontend) emoji-picker fix lack of overlay
The EmojiPicker component now displays an overlay when opened, it fixes an issue when multiple pickers are present on the same page and we click on one of them, the others were not closing.
1 parent 08f3cea commit 9d3c1eb

File tree

3 files changed

+30
-3
lines changed

3 files changed

+30
-3
lines changed

src/frontend/apps/impress/src/features/docs/doc-editor/components/EmojiPicker.tsx

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,18 @@ interface EmojiPickerProps {
99
emojiData: EmojiMartData;
1010
onClickOutside: () => void;
1111
onEmojiSelect: ({ native }: { native: string }) => void;
12+
withOverlay?: boolean;
1213
}
1314

1415
export const EmojiPicker = ({
1516
emojiData,
1617
onClickOutside,
1718
onEmojiSelect,
19+
withOverlay = false,
1820
}: EmojiPickerProps) => {
1921
const { i18n } = useTranslation();
2022

21-
return (
23+
const pickerContent = (
2224
<Box $position="absolute" $zIndex={1000} $margin="2rem 0 0 0">
2325
<Picker
2426
data={emojiData}
@@ -30,4 +32,27 @@ export const EmojiPicker = ({
3032
/>
3133
</Box>
3234
);
35+
36+
if (withOverlay) {
37+
return (
38+
<>
39+
{/* Overlay transparent pour fermer en cliquant à l'extérieur */}
40+
<div
41+
style={{
42+
position: 'fixed',
43+
top: 0,
44+
left: 0,
45+
width: '100vw',
46+
height: '100vh',
47+
zIndex: 999,
48+
backgroundColor: 'transparent',
49+
}}
50+
onClick={onClickOutside}
51+
/>
52+
{pickerContent}
53+
</>
54+
);
55+
}
56+
57+
return pickerContent;
3358
};

src/frontend/apps/impress/src/features/docs/doc-editor/components/custom-blocks/CalloutBlock.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ const CalloutComponent = ({
122122
emojiData={emojidata}
123123
onClickOutside={onClickOutside}
124124
onEmojiSelect={onEmojiSelect}
125+
withOverlay={true}
125126
/>
126127
)}
127128
<Box as="p" className="inline-content" ref={contentRef} />

src/frontend/apps/impress/src/features/docs/doc-management/components/DocIcon.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ export const DocIcon = ({
7777
return (
7878
<>
7979
<BoxButton
80+
className="--docs--doc-icon"
8081
ref={iconRef}
8182
onClick={toggleEmojiPicker}
82-
$position="relative"
83-
className="--docs--doc-icon"
83+
color="tertiary-text"
8484
>
8585
{!emoji ? (
8686
defaultIcon
@@ -112,6 +112,7 @@ export const DocIcon = ({
112112
emojiData={emojidata}
113113
onEmojiSelect={handleEmojiSelect}
114114
onClickOutside={handleClickOutside}
115+
withOverlay={true}
115116
/>
116117
</div>,
117118
document.body,

0 commit comments

Comments
 (0)