From 0f886e86cee15e8f67e83e2525e60a7c401df4f0 Mon Sep 17 00:00:00 2001 From: geroxima Date: Sat, 20 Jul 2024 11:38:01 -0400 Subject: [PATCH 1/6] feat: input form to enter the prompt, save the prompt in state --- src/App.css | 4 ---- src/App.jsx | 7 +++++- src/components/Chat.jsx | 50 +++++++++++++++++++++++++++++++++++++++++ src/components/Map.jsx | 2 +- 4 files changed, 57 insertions(+), 6 deletions(-) create mode 100644 src/components/Chat.jsx diff --git a/src/App.css b/src/App.css index f34bf09..6bc035c 100644 --- a/src/App.css +++ b/src/App.css @@ -3,10 +3,6 @@ @tailwind utilities; -.map { - height: 60vh; -} - .loader-dots div { animation-timing-function: cubic-bezier(0, 1, 1, 0); } diff --git a/src/App.jsx b/src/App.jsx index f88af72..0e97aa1 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,13 +1,18 @@ import { useState } from 'react' import MapComponent from './components/Map.jsx' +import Chat from './components/Chat.jsx'; const App = () => { let [places, setPlaces] = useState([]); return ( <> -
+
+ + + +
); diff --git a/src/components/Chat.jsx b/src/components/Chat.jsx new file mode 100644 index 0000000..ab1f80a --- /dev/null +++ b/src/components/Chat.jsx @@ -0,0 +1,50 @@ +import { Textarea } from "@headlessui/react"; +import { useState } from "react"; + +const Chat = () => { + + const [prompt, setPrompt] = useState(""); + const [messageSent, setMessageSent] = useState(false); + + const handleChange = (e) => { + setPrompt(e.target.value); + setMessageSent(false); + }; + + const handleSubmit = (e) => { + e.preventDefault(); + console.log(prompt); + setPrompt(""); + setMessageSent(true); + + } + + const handleKeyPress = (e) => { + if (e.key === 'Enter' && !e.shiftKey) { + e.preventDefault(); + handleSubmit(e) + } + } + + return ( +
+
+
+ {/* {prompt} */} +
+
+