Skip to content

Commit 6a04326

Browse files
author
Dylan Huang
committed
Update chat width calculation to set maximum width as 80% of container width
1 parent 6bcd294 commit 6a04326

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

vite-app/src/components/ChatInterface.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,14 @@ export const ChatInterface = ({ messages }: ChatInterfaceProps) => {
2626
e.preventDefault();
2727
const deltaX = e.clientX - initialMouseX;
2828
const newWidth = initialWidth + deltaX;
29-
setChatWidth(Math.max(300, Math.min(1200, newWidth))); // Min 300px, max 1200px
29+
30+
// Calculate max width as 80% of container width
31+
const containerWidth =
32+
chatContainerRef.current?.parentElement?.clientWidth ||
33+
window.innerWidth;
34+
const maxWidth = containerWidth * 0.8;
35+
36+
setChatWidth(Math.max(300, Math.min(maxWidth, newWidth))); // Min 300px, max 80% of container
3037
}
3138
};
3239

0 commit comments

Comments
 (0)