From 43b07ebfe5e73f3602fa5465becb45e28e2fe7df Mon Sep 17 00:00:00 2001 From: Silberengel Date: Sun, 7 Jun 2026 07:20:54 +0200 Subject: [PATCH] bug-fix emoji drawer --- src/components/EmojiPicker/index.tsx | 30 +++++++++++++++++----- src/components/EmojiPickerDialog/index.tsx | 5 ++-- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/src/components/EmojiPicker/index.tsx b/src/components/EmojiPicker/index.tsx index 43df4b15..5306f623 100644 --- a/src/components/EmojiPicker/index.tsx +++ b/src/components/EmojiPicker/index.tsx @@ -1,4 +1,5 @@ import { EMOJI_PICKER_DATA_SOURCE } from '@/lib/emoji-picker-data-source' +import { cn } from '@/lib/utils' import { preloadEmojiPickerModule } from '@/lib/emoji-picker-preload' import { DEFAULT_LIKE_REACTION_CONTENT, DEFAULT_LIKE_REACTION_DISPLAY_EMOJI, DEFAULT_SUGGESTED_EMOJIS } from '@/lib/like-reaction-emojis' import { recordEmojiUsed } from '@/lib/recently-used-emojis' @@ -14,12 +15,16 @@ export { DEFAULT_SUGGESTED_EMOJIS as EMOJI_PICKER_REACTIONS } from '@/lib/like-r export default function EmojiPicker({ onEmojiClick, reactionsDefaultOpen, - reactions + reactions, + layout = 'popover' }: { onEmojiClick: (emoji: string | TEmoji | undefined, event: Event) => void reactionsDefaultOpen?: boolean reactions?: string[] + /** `drawer` fills the mobile sheet; `popover` uses a fixed height for dropdowns. */ + layout?: 'drawer' | 'popover' }) { + const inDrawer = layout === 'drawer' const { themeSetting } = useTheme() const { pubkey } = useNostr() const [mode, setMode] = useState<'reactions' | 'full'>( @@ -66,8 +71,13 @@ export default function EmojiPicker({ picker.style.width = '100%' picker.style.minWidth = '280px' picker.style.maxWidth = '350px' - picker.style.height = 'min(350px, 50dvh)' - picker.style.minHeight = '280px' + if (inDrawer) { + picker.style.height = '100%' + picker.style.minHeight = '0' + } else { + picker.style.height = 'min(350px, 50dvh)' + picker.style.minHeight = '280px' + } picker.style.setProperty('--num-columns', '8') const handleClick = (e: Event) => { @@ -124,7 +134,7 @@ export default function EmojiPicker({ pickerRef.current = null } } - }, [mode]) + }, [mode, inDrawer]) useEffect(() => { if (pickerRef.current) { @@ -197,11 +207,19 @@ export default function EmojiPicker({ } return ( -
+
{ownEmojisRow}
{!pickerReady ? (
diff --git a/src/components/EmojiPickerDialog/index.tsx b/src/components/EmojiPickerDialog/index.tsx index d95d4d3a..229d9d5d 100644 --- a/src/components/EmojiPickerDialog/index.tsx +++ b/src/components/EmojiPickerDialog/index.tsx @@ -50,7 +50,7 @@ export default function EmojiPickerDialog({ { const t = e.target as HTMLElement | null if (t?.closest?.('[data-vaul-overlay]')) return @@ -60,9 +60,10 @@ export default function EmojiPickerDialog({ Emoji Picker -
+
{pickerMounted ? ( { e.stopPropagation() setOpen(false)