Skip to content

Commit 9be63e2

Browse files
author
Dylan Huang
committed
Refactor ChatInterface component to improve resize handle functionality and positioning, enhancing user experience for chat window adjustments.
1 parent 75934d2 commit 9be63e2

1 file changed

Lines changed: 14 additions & 11 deletions

File tree

vite-app/src/components/ChatInterface.tsx

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -112,33 +112,36 @@ export const ChatInterface = ({ messages }: ChatInterfaceProps) => {
112112
style={{ width: `${chatWidth}px` }}
113113
>
114114
<div
115-
className="bg-white border border-gray-200 p-4 overflow-y-auto"
115+
className="bg-white border border-gray-200 p-4 overflow-y-auto relative"
116116
style={{ height: `${chatHeight}px` }}
117117
>
118118
{messages.map((message, msgIndex) => (
119119
<MessageBubble key={msgIndex} message={message} />
120120
))}
121121
</div>
122122

123-
{/* Horizontal resize handle */}
123+
{/* Vertical resize handle - positioned outside the scrollable container */}
124124
<div
125-
ref={resizeHandleRef}
126-
className="absolute top-0 right-0 w-1 h-full bg-gray-300 cursor-col-resize hover:bg-gray-400 transition-colors select-none"
127-
onMouseDown={startWidthResize}
125+
ref={heightResizeHandleRef}
126+
className="absolute left-0 w-full h-1 bg-gray-300 cursor-row-resize hover:bg-gray-400 transition-colors select-none"
127+
style={{ top: `${chatHeight}px` }}
128+
onMouseDown={startHeightResize}
128129
onDragStart={(e) => e.preventDefault()}
129130
/>
130131

131-
{/* Vertical resize handle */}
132+
{/* Horizontal resize handle */}
132133
<div
133-
ref={heightResizeHandleRef}
134-
className="absolute bottom-0 left-0 w-full h-1 bg-gray-300 cursor-row-resize hover:bg-gray-400 transition-colors select-none"
135-
onMouseDown={startHeightResize}
134+
ref={resizeHandleRef}
135+
className="absolute top-0 right-0 w-1 bg-gray-300 cursor-col-resize hover:bg-gray-400 transition-colors select-none"
136+
style={{ height: `${chatHeight}px` }}
137+
onMouseDown={startWidthResize}
136138
onDragStart={(e) => e.preventDefault()}
137139
/>
138140

139-
{/* Corner resize handle */}
141+
{/* Corner resize handle - positioned outside the scrollable container */}
140142
<div
141-
className="absolute bottom-0 right-0 w-3 h-3 bg-gray-300 cursor-nw-resize hover:bg-gray-400 transition-colors select-none"
143+
className="absolute w-3 h-3 bg-gray-300 cursor-nw-resize hover:bg-gray-400 transition-colors select-none"
144+
style={{ top: `${chatHeight - 8}px`, right: "0px" }}
142145
onMouseDown={startCornerResize}
143146
onDragStart={(e) => e.preventDefault()}
144147
/>

0 commit comments

Comments
 (0)