diff --git a/app/src/components/ExpandingTextArea.tsx b/app/src/components/ExpandingTextArea.tsx index 86a1ca4d..74beb98e 100644 --- a/app/src/components/ExpandingTextArea.tsx +++ b/app/src/components/ExpandingTextArea.tsx @@ -1,59 +1,96 @@ import { useEffect, useRef } from "react"; import styled from "styled-components"; +import { MentionsInput, Mention } from "react-mentions"; +import useMentionList from "@features/chats/hooks/useMentionList"; -const Textarea = styled.textarea` - outline: none; - border: none; - - flex: 1; - align-self: center; - - caret-color: var(--accent-color); +const StyledMentionsInput = styled.div` + width: 100%; + max-width: 27rem; color: var(--color-text); - - resize: none; - overflow: hidden; - - font-size: 1rem; - line-height: 1.5; - padding: 0.25rem; - - max-height: 300px; `; type PropsType = { input: string; setInput: (value: string) => void; - onKeyDown?: (e: React.KeyboardEvent) => void; + onKeyDown?: ( + e: + | React.KeyboardEvent + | React.KeyboardEvent + ) => void; }; function ExpandingTextArea({ input, setInput, onKeyDown }: PropsType) { - const ref = useRef(null); + const textareaRef = useRef(null); + + const { filteredMembers } = useMentionList(); function handleInput() { - if (ref.current) { - ref.current.style.height = "auto"; - ref.current.style.height = `${ref.current.scrollHeight}px`; + if (textareaRef.current) { + textareaRef.current.style.height = "auto"; + textareaRef.current.style.height = `${textareaRef.current.scrollHeight}px`; } } + useEffect(() => { - if (ref.current) { - if (ref.current.value === "" || input === "") { - ref.current.style.height = "32px"; + if (textareaRef.current) { + if (textareaRef.current.value === "" || input === "") { + textareaRef.current.style.height = "32px"; } } }, [input]); + console.log(filteredMembers); + return ( -