From 6280f5f9e9c76a3770144ccd35f39c293e2f8cec Mon Sep 17 00:00:00 2001 From: Joana Parente Date: Fri, 9 Feb 2024 12:42:09 +0000 Subject: [PATCH] . --- src/pages/work-with-me/index.tsx | 54 +------------------------------- 1 file changed, 1 insertion(+), 53 deletions(-) diff --git a/src/pages/work-with-me/index.tsx b/src/pages/work-with-me/index.tsx index 801ec0e..2612e77 100644 --- a/src/pages/work-with-me/index.tsx +++ b/src/pages/work-with-me/index.tsx @@ -1,43 +1,8 @@ import { ArrowRight, MoveUpRight } from "lucide-react"; import SkillBar from "../../components/SkillBar"; import Button from "../../components/ui/Button"; -import { useNavigate } from "react-router-dom"; -import { useState } from "react"; - -function encode(data: Record) { - return Object.keys(data) - .map((key) => encodeURIComponent(key) + "=" + encodeURIComponent(data[key])) - .join("&"); -} function WorkWithMe() { - const navigate = useNavigate(); - - const [state, setState] = useState({}); - - const handleChange = ( - e: React.ChangeEvent< - HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement - > - ) => { - setState({ ...state, [e.target.name]: e.target.value }); - }; - - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const handleSubmit = (e: any) => { - e.preventDefault(); - const form = e.target; - fetch("/", { - method: "POST", - headers: { "Content-Type": "application/x-www-form-urlencoded" }, - body: encode({ - "form-name": form.getAttribute("name"), - ...state, - }), - }) - .then(() => navigate(form.getAttribute("action"))) - .catch((error) => alert(error)); - }; return ( <>
@@ -288,15 +253,7 @@ function WorkWithMe() {

-
+
@@ -307,7 +264,6 @@ function WorkWithMe() { placeholder="First Name*" className="block py-2.5 px-0 w-full text-sm text-gray-900 bg-transparent border-0 border-b-2 border-gray-300 appearance-none dark:text-white dark:border-gray-600 dark:focus:border-primary-500 focus:outline-none focus:ring-0 focus:border-primary-600 peer" required - onChange={handleChange} />
@@ -318,7 +274,6 @@ function WorkWithMe() { placeholder="Last Name*" className="block py-2.5 px-0 w-full text-sm text-gray-900 bg-transparent border-0 border-b-2 border-gray-300 appearance-none dark:text-white dark:border-gray-600 dark:focus:border-primary-500 focus:outline-none focus:ring-0 focus:border-primary-600 peer" required - onChange={handleChange} />
@@ -329,7 +284,6 @@ function WorkWithMe() { placeholder="Email*" className="block py-2.5 px-0 w-full text-sm text-gray-900 bg-transparent border-0 border-b-2 border-gray-300 appearance-none dark:text-white dark:border-gray-600 dark:focus:border-primary-500 focus:outline-none focus:ring-0 focus:border-primary-600 peer" required - onChange={handleChange} >
@@ -339,7 +293,6 @@ function WorkWithMe() { name="website" placeholder="Your current website (if you have one)" className="block py-2.5 px-0 w-full text-sm text-gray-900 bg-transparent border-0 border-b-2 border-gray-300 appearance-none dark:text-white dark:border-gray-600 dark:focus:border-primary-500 focus:outline-none focus:ring-0 focus:border-primary-600 peer" - onChange={handleChange} />
@@ -350,7 +303,6 @@ function WorkWithMe() { rows={5} className="block py-2.5 px-0 w-full text-sm text-gray-900 bg-transparent border-0 border-b-2 border-gray-300 appearance-none dark:text-white dark:border-gray-600 dark:focus:border-primary-500 focus:outline-none focus:ring-0 focus:border-primary-600 peer" required - onChange={handleChange} >
@@ -360,7 +312,6 @@ function WorkWithMe() { className="block py-2.5 px-0 w-full text-sm text-gray-900 bg-transparent border-0 border-b-2 border-gray-300 appearance-none dark:bg-neutral-900 dark:text-white dark:border-gray-600 dark:focus:border-primary-500 focus:outline-none focus:ring-0 focus:border-primary-600 peer" required defaultValue="" - onChange={handleChange} >