diff --git a/.gitignore b/.gitignore index 6a7d6d8..037f0c5 100644 --- a/.gitignore +++ b/.gitignore @@ -127,4 +127,6 @@ dist .yarn/unplugged .yarn/build-state.yml .yarn/install-state.gz -.pnp.* \ No newline at end of file +.pnp.* + +functions/serviceAccountKey.json \ No newline at end of file diff --git a/client/src/components/App.css b/client/src/components/App.css index 9a18e2d..785cd90 100644 --- a/client/src/components/App.css +++ b/client/src/components/App.css @@ -242,3 +242,63 @@ html{ } } +.form-container { + display: flex; + flex-direction: column; + gap: 1rem; + width: 300px; + margin: 0 auto; + padding: 1rem; + border-radius: 8px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); +} + +.input-container { + display: flex; + flex-direction: column; +} + +.input-style { + padding: 0.5rem; + border-radius: 4px; + border: 1px solid #ccc; +} + +.textarea-style { + padding: 0.5rem; + border-radius: 4px; + border: 1px solid #ccc; + height: 100px; + resize: none; +} + +.button-style { + padding: 0.5rem 1rem; + border-radius: 4px; + border: none; + background: #007BFF; + color: #fff; + cursor: pointer; +} + +.popup-style { + position: fixed; + top: 20px; + left: 50%; + transform: translateX(-50%); + background: #fff; + color:black; + padding: 1rem; + border-radius: 8px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); + z-index: 1000; + text-align: center; +} + +.time-bar-style { + position: absolute; + bottom: 0; + left: 0; + height: 5px; + background: #007BFF; +} diff --git a/client/src/components/ContactMe.jsx b/client/src/components/ContactMe.jsx index b16eb62..44b8217 100644 --- a/client/src/components/ContactMe.jsx +++ b/client/src/components/ContactMe.jsx @@ -1,11 +1,93 @@ -import React from "react"; +import React, { useState } from "react"; +import axios from "axios"; +import { motion, AnimatePresence } from "framer-motion"; -function ContactMe(props){ - return( - +function ContactMe() { + const [formData, setFormData] = useState({ + email: "", + name: "", + subject: "", + body: "" + }); + + const [responseMessage, setResponseMessage] = useState(""); + const [showPopup, setShowPopup] = useState(false); + + const handleChange = (e) => { + const { name, value } = e.target; + setFormData({ + ...formData, + [name]: value + }); + }; + + const handleSubmit = async (e) => { + e.preventDefault(); + try { + const response = await axios.post("http://127.0.0.1:5001/portfolio-abhishekverma/us-central1/api/contact", formData); + setResponseMessage(response.data.message); + setShowPopup(true); + setTimeout(() => { + setShowPopup(false); + }, 2000); + setFormData({ + email: "", + name: "", + subject: "", + body: "" + }); + } catch (error) { + setResponseMessage("Error submitting the form"); + setShowPopup(true); + setTimeout(() => { + setShowPopup(false); + }, 2000); + console.error("Error submitting the form", error); + } + }; + + return ( +
+
+
+ + +
+
+ + +
+
+ + +
+
+ +