Fix close button z-index on FloatingChatButton

Moved close button to render after main button so it appears on top
and is clickable in the overlapping area
This commit is contained in:
MK Fain committed 2025-12-03 20:49:37 -06:00
1 parent 1b287b90aa
commit ecf6b72b21
1 file changed
+15 -15
+15 -15
View File
@@ -44,21 +44,6 @@ export function FloatingChatButton() {
onMouseEnter={() => setIsHovered(true)}
onMouseLeave={() => setIsHovered(false)}
>
{/* Close button - appears on hover */}
<Button
onClick={handleClose}
size="icon"
variant="secondary"
className={cn(
'absolute -top-2 -right-2 h-6 w-6 rounded-full shadow-md border',
'transition-all duration-200',
isHovered ? 'opacity-100 scale-100' : 'opacity-0 scale-75 pointer-events-none'
)}
aria-label="Hide chat button"
>
<X className="h-3 w-3" />
</Button>
{/* Main chat button */}
<Button
onClick={() => setIsOpen(!isOpen)}
@@ -78,6 +63,21 @@ export function FloatingChatButton() {
<span className="absolute top-0 right-0 h-3 w-3 rounded-full bg-destructive ring-2 ring-background" />
)}
</Button>
{/* Close button - appears on hover, rendered last to be on top */}
<Button
onClick={handleClose}
size="icon"
variant="secondary"
className={cn(
'absolute -top-2 -right-2 h-6 w-6 rounded-full shadow-md border',
'transition-all duration-200',
isHovered ? 'opacity-100 scale-100' : 'opacity-0 scale-75 pointer-events-none'
)}
aria-label="Hide chat button"
>
<X className="h-3 w-3" />
</Button>
</div>
);
}