"use client"; import { useState } from "react"; import Link from "next/link"; import { Check } from "lucide-react"; import DemoButton from "@/components/ui/DemoButton"; import { CHAMFER } from "@/lib/chamfer"; /* ────────────────────────────────────────────────────────────────────────── * Shared lead form — one light "contact card" (tool-ctrl.de style) reused by * both the /demo booking page and the footer. Paired fields, consent-on-submit * (no checkbox), posts to POST /api/demo-request. * ────────────────────────────────────────────────────────────────────────── */ const EMPTY = { firstName: "", lastName: "", company: "", industry: "", email: "", phone: "", message: "", }; export default function LeadForm({ submitLabel = "Anfrage senden", }: { submitLabel?: string; }) { const [form, setForm] = useState(EMPTY); const [state, setState] = useState<"idle" | "loading" | "ok" | "err">("idle"); const [errMsg, setErrMsg] = useState(""); const set = (k: keyof typeof form, v: string) => setForm((f) => ({ ...f, [k]: v })); const onSubmit = async (e: React.FormEvent) => { e.preventDefault(); if (!form.firstName || !form.lastName || !form.email || !form.message) return; setState("loading"); setErrMsg(""); try { const res = await fetch("/api/demo-request", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(form), }); if (!res.ok) { const data = await res.json().catch(() => null); throw new Error(data?.error || "Fehler beim Senden."); } setState("ok"); } catch (err) { setState("err"); setErrMsg(err instanceof Error ? err.message : "Fehler beim Senden."); } }; const cardStyle = { background: "var(--surface)", clipPath: CHAMFER, filter: "drop-shadow(0 24px 40px rgba(15,23,42,0.22))", } as const; const labelCls = "text-[11px] font-semibold uppercase tracking-widest"; const labelStyle = { color: "var(--text-tertiary)" } as const; const inputCls = "h-12 w-full rounded-lg px-3.5 text-[15px] outline-none transition-shadow focus:ring-2 focus:ring-[var(--accent-yellow)]"; const inputStyle = { border: "1px solid var(--border-neutral)", background: "var(--surface)", color: "var(--text-primary)", } as const; /* ── Success ── */ if (state === "ok") { return (

Vielen Dank für deine Anfrage!

Wir haben deine Daten erhalten und melden uns in Kürze persönlich bei dir, nicht automatisiert.

); } /* ── Form ── */ return (