diff --git a/app/src/components/ui/collaboration/Messages.tsx b/app/src/components/ui/collaboration/Messages.tsx index 3440204..3fffb4b 100644 --- a/app/src/components/ui/collaboration/Messages.tsx +++ b/app/src/components/ui/collaboration/Messages.tsx @@ -1,30 +1,71 @@ -import React, { useState } from "react"; +import React, { useEffect, useRef, useState } from "react"; import { getAvatarColor } from "../../../modules/collaboration/functions/getAvatarColor"; import { KebabIcon } from "../../icons/ExportCommonIcons"; +import { adjustHeight } from "./function/textAreaHeightAdjust"; interface MessageProps { - val: Reply; + val: Reply | CommentSchema; i: number; } const Messages: React.FC = ({ val, i }) => { const [isEditing, setIsEditing] = useState(false); const [openOptions, setOpenOptions] = useState(false); + + // input + const [value, setValue] = useState( + "reply" in val ? val.reply : val.comment + ); + const textareaRef = useRef(null); const currentUser = "1"; const UserName = "username"; + useEffect(() => { + if (textareaRef.current) adjustHeight(textareaRef.current); + }, [value]); + + function handleCancelAction() { + setIsEditing(false); + } + + function handleSaveAction() { + setIsEditing(false); + } + return ( <> {isEditing ? (
-