From 2a9ee6c66755f1957cee91fd183c32c557f7bf42 Mon Sep 17 00:00:00 2001 From: Chneemann Date: Tue, 4 Aug 2026 17:00:28 +0200 Subject: [PATCH] feat: add localized contact form and translations for contact section --- src/components/Contact.tsx | 40 +++++++++++++++++++++----------------- src/i18n/messages/de.json | 15 ++++++++++++++ src/i18n/messages/en.json | 15 ++++++++++++++ 3 files changed, 52 insertions(+), 18 deletions(-) diff --git a/src/components/Contact.tsx b/src/components/Contact.tsx index edc7027..fe2b376 100644 --- a/src/components/Contact.tsx +++ b/src/components/Contact.tsx @@ -1,11 +1,15 @@ "use client"; import { useState } from "react"; +import { useTranslations } from "next-intl"; /** * Contact section with interactive form, bot anti-spam protection, and Formspree integration */ export default function Contact() { + const tCommon = useTranslations("Common"); + const tContact = useTranslations("Contact"); + // Form input states const [name, setName] = useState(""); const [email, setEmail] = useState(""); @@ -21,7 +25,7 @@ export default function Contact() { const [formLoadTime] = useState(Date.now()); // Handles contact form submission with bot verification & Formspree dispatch - const handleSubmit = async (e: React.FormEvent) => { + const handleSubmit = async (e: React.SubmitEvent) => { e.preventDefault(); // Anti-spam check 1: Submissions faster than 1 seconds are treated as automated bots @@ -81,10 +85,11 @@ export default function Contact() { {/* Section Header */}

- // 04. Get in Touch + // 04. {tContact("sectionSub")}

- Contact me. + {tCommon("contact")} + .

@@ -96,15 +101,13 @@ export default function Contact() {

- // Got - a project in mind? + //{" "} + {tContact("cardTitle")}

- Feel free to reach out using this form. I am always open to - discussing new projects, creative ideas, or opportunities to - contribute to your team. + {tContact("cardDescription")}

{/* Terminal Status Display */} @@ -126,7 +129,7 @@ export default function Contact() { {/* Email Shortcut */}
- // Prefer email? + // {tContact("preferEmail")} dev@andre-kempf.com @@ -148,10 +151,11 @@ export default function Contact() {
-

Thank you!

+

+ {tContact("successTitle")} +

- Your message has been sent successfully. I'll get back to - you as soon as possible! + {tContact("successText")}

) : ( @@ -177,7 +181,7 @@ export default function Contact() { {/* Name Input */}