Make comment drawer overlay without affecting message layout

- Drawer now absolutely positioned (doesn't push messages down)
- Positioned top-full right-0 from badge
- Added shadow-xl for better visual separation
- High z-index (z-50) to overlay other content
- No vertical layout shift when expanding/collapsing
- Messages stay in their original positions
This commit is contained in:
spencrmartin
2025-11-23 08:52:45 -05:00
parent e0504287d3
commit 796c45b1cb
2 changed files with 28 additions and 28 deletions
+2 -2
View File
@@ -59,8 +59,8 @@ export default function CommentDrawer({
<div
data-comment-ui
className={cn(
'border border-border-subtle rounded-lg overflow-hidden transition-all duration-200',
'bg-background-default',
'border border-border-subtle rounded-lg overflow-hidden',
'bg-background-default shadow-xl',
className
)}
>
+26 -26
View File
@@ -61,37 +61,37 @@ export default function MessageComments({
return null;
}
// Condensed mode: show badge on right, drawer expands below it
// Condensed mode: show badge on right, drawer overlays below it
if (displayMode === 'condensed') {
return (
<div className={cn('mt-3 flex justify-end', className)}>
<div className="w-96 max-w-full">
<div className={cn('mt-3 flex justify-end relative', className)}>
<div className="relative">
{/* Badge on the right */}
<div className="flex justify-end mb-2">
<CommentBadge
comments={comments}
position={badgePosition}
onClick={() => setIsDrawerExpanded(!isDrawerExpanded)}
/>
</div>
<CommentBadge
comments={comments}
position={badgePosition}
onClick={() => setIsDrawerExpanded(!isDrawerExpanded)}
/>
{/* Expandable drawer below badge */}
{/* Expandable drawer overlays below badge - doesn't affect layout */}
{isDrawerExpanded && (
<CommentDrawer
messageId={messageId}
comments={comments}
selectedText={activeSelection?.selectedText}
isExpanded={isDrawerExpanded}
onToggle={() => setIsDrawerExpanded(!isDrawerExpanded)}
activeSelection={activeSelection}
isCreatingComment={isCreatingComment}
onCreateComment={onCreateComment}
onUpdateComment={onUpdateComment}
onDeleteComment={onDeleteComment}
onReplyToComment={onReplyToComment}
onResolveComment={onResolveComment}
onCancelComment={onCancelComment}
/>
<div className="absolute top-full right-0 mt-2 w-96 max-w-[90vw] z-50">
<CommentDrawer
messageId={messageId}
comments={comments}
selectedText={activeSelection?.selectedText}
isExpanded={isDrawerExpanded}
onToggle={() => setIsDrawerExpanded(!isDrawerExpanded)}
activeSelection={activeSelection}
isCreatingComment={isCreatingComment}
onCreateComment={onCreateComment}
onUpdateComment={onUpdateComment}
onDeleteComment={onDeleteComment}
onReplyToComment={onReplyToComment}
onResolveComment={onResolveComment}
onCancelComment={onCancelComment}
/>
</div>
)}
</div>
</div>