diff --git a/src/frontend/src/modals/chatModal/chatInput/index.tsx b/src/frontend/src/modals/chatModal/chatInput/index.tsx index 2fb600068..657b27f6f 100644 --- a/src/frontend/src/modals/chatModal/chatInput/index.tsx +++ b/src/frontend/src/modals/chatModal/chatInput/index.tsx @@ -1,43 +1,55 @@ import { LockClosedIcon, PaperAirplaneIcon } from "@heroicons/react/24/outline"; import { classNames } from "../../../utils"; -import { useRef } from "react"; +import { useEffect, useRef, useState } from "react"; export default function ChatInput({ lockChat, chatValue, sendMessage, setChatValue, -}: { - lockChat: boolean; - chatValue: string; - sendMessage: Function; - setChatValue: Function; + inputRef, }) { - const inputRef = useRef(null); + useEffect(() => { + if (inputRef.current) { + inputRef.current.style.height = "inherit"; // Reset the height + inputRef.current.style.height = `${inputRef.current.scrollHeight}px`; // Set it to the scrollHeight + } + }, [chatValue]); + return ( - <> +