From 4494bc713ddbd3248fcd0930f231b99493d2c5e9 Mon Sep 17 00:00:00 2001 From: Deveshi Dwivedi Date: Thu, 27 Jun 2024 19:57:10 +0530 Subject: [PATCH] add chat input component --- modules/room/components/chat/ChatInput.tsx | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 modules/room/components/chat/ChatInput.tsx diff --git a/modules/room/components/chat/ChatInput.tsx b/modules/room/components/chat/ChatInput.tsx new file mode 100644 index 0000000..e300767 --- /dev/null +++ b/modules/room/components/chat/ChatInput.tsx @@ -0,0 +1,27 @@ +import {socket} from "@/common/lib/socket"; +import {FormEvent, useState} from "react"; +import { AiOutlineSend } from "react-icons/ai"; + +const ChatInput = () => { + const [msg, setMsg] = useState(""); + const handleSubmit= (e: FormEvent)=> { + e.preventDefault(); + socket.emit("send_msg", msg); + setMsg(""); + }; + return ( +
+ setMsg(e.target.value)} + /> + +
+ ); +}; + +export default ChatInput; \ No newline at end of file