fix: emoji picker uses full panel width with no dead space

Remove width: 100% !important override that fought emoji-mart's shadow
DOM grid. Container now uses w-fit to wrap content tightly. GIF picker
gets explicit w-[390px] to maintain its own width independently.
This commit is contained in:
Jannis Braun
2026-03-15 02:39:52 +01:00
parent 42266ff963
commit 6701ccc9b4
3 changed files with 3 additions and 16 deletions
@@ -79,7 +79,7 @@ export function GifPicker({ onGifSelect }: GifPickerProps) {
}; };
return ( return (
<div className="flex flex-col h-[390px]" onKeyDown={handleKeyDown}> <div className="flex flex-col h-[390px] w-[390px]" onKeyDown={handleKeyDown}>
{/* Search */} {/* Search */}
<div className="px-3 pt-2 pb-1.5"> <div className="px-3 pt-2 pb-1.5">
<input <input
@@ -2,20 +2,16 @@ import React, { useRef, useEffect, useCallback } from 'react';
import { createPortal } from 'react-dom'; import { createPortal } from 'react-dom';
import { EmojiPicker } from './EmojiPicker'; import { EmojiPicker } from './EmojiPicker';
import { GifPicker } from './GifPicker'; import { GifPicker } from './GifPicker';
import { StickerPicker } from './StickerPicker';
import type { Sticker } from '@backspace/shared';
export type InputPopoverTab = 'emoji' | 'gif' | 'stickers'; export type InputPopoverTab = 'emoji' | 'gif';
interface InputPopoverProps { interface InputPopoverProps {
activeTab: InputPopoverTab; activeTab: InputPopoverTab;
onClose: () => void; onClose: () => void;
onEmojiSelect: (emoji: { native: string }) => void; onEmojiSelect: (emoji: { native: string }) => void;
onGifSelect: (url: string) => void; onGifSelect: (url: string) => void;
onStickerSelect: (sticker: Sticker) => void;
anchorRef: React.RefObject<HTMLElement | null>; anchorRef: React.RefObject<HTMLElement | null>;
gifEnabled: boolean; gifEnabled: boolean;
stickersEnabled: boolean;
onTabChange: (tab: InputPopoverTab) => void; onTabChange: (tab: InputPopoverTab) => void;
} }
@@ -24,10 +20,8 @@ export function InputPopover({
onClose, onClose,
onEmojiSelect, onEmojiSelect,
onGifSelect, onGifSelect,
onStickerSelect,
anchorRef, anchorRef,
gifEnabled, gifEnabled,
stickersEnabled,
onTabChange, onTabChange,
}: InputPopoverProps) { }: InputPopoverProps) {
const floatingRef = useRef<HTMLDivElement>(null); const floatingRef = useRef<HTMLDivElement>(null);
@@ -105,9 +99,6 @@ export function InputPopover({
if (gifEnabled) { if (gifEnabled) {
availableTabs.splice(0, 0, { key: 'gif', label: 'GIF' }); availableTabs.splice(0, 0, { key: 'gif', label: 'GIF' });
} }
if (stickersEnabled) {
availableTabs.push({ key: 'stickers', label: 'Stickers' });
}
const showTabs = availableTabs.length > 1; const showTabs = availableTabs.length > 1;
@@ -117,7 +108,7 @@ export function InputPopover({
className="fixed z-[300] animate-slide-up" className="fixed z-[300] animate-slide-up"
style={{ top: -9999, left: -9999 }} style={{ top: -9999, left: -9999 }}
> >
<div className="glass rounded-xl overflow-hidden flex flex-col" style={{ width: 352, maxHeight: 435 }}> <div className="glass rounded-xl overflow-hidden flex flex-col w-fit max-h-[435px]">
{/* Tab bar */} {/* Tab bar */}
{showTabs && ( {showTabs && (
<div className="flex items-center gap-0.5 px-2 pt-2 pb-1"> <div className="flex items-center gap-0.5 px-2 pt-2 pb-1">
@@ -145,9 +136,6 @@ export function InputPopover({
{activeTab === 'gif' && gifEnabled && ( {activeTab === 'gif' && gifEnabled && (
<GifPicker onGifSelect={onGifSelect} /> <GifPicker onGifSelect={onGifSelect} />
)} )}
{activeTab === 'stickers' && stickersEnabled && (
<StickerPicker onStickerSelect={onStickerSelect} />
)}
</div> </div>
</div> </div>
</div>, </div>,
-1
View File
@@ -303,7 +303,6 @@
--font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif; --font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
border: none !important; border: none !important;
background: transparent !important; background: transparent !important;
width: 100% !important;
max-height: 400px; max-height: 400px;
} }