chore(repo): sync wireframe structure and references

This commit is contained in:
david committed 2026-08-08 03:09:06 +02:00
1 parent 05d2d5777f
commit d953a79e95
453 files changed
+36639 -621

No files matched your search

@@ -0,0 +1,164 @@
"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 (
<div
className="flex flex-col items-start gap-4"
style={{ ...cardStyle, padding: "clamp(28px, 5vw, 44px)" }}
>
<div
className="flex items-center justify-center rounded-full"
style={{ width: 56, height: 56, background: "var(--accent-yellow-light)" }}
>
<Check size={28} style={{ color: "var(--accent-yellow)" }} />
</div>
<h3 className="text-[22px] font-bold" style={{ color: "var(--text-primary)" }}>
Vielen Dank für deine Anfrage!
</h3>
<p className="text-[15px] leading-relaxed" style={{ color: "var(--text-secondary)" }}>
Wir haben deine Daten erhalten und melden uns in Kürze persönlich bei
dir, nicht automatisiert.
</p>
</div>
);
}
/* ── Form ── */
return (
<div style={{ ...cardStyle, padding: "clamp(24px, 4vw, 40px)" }}>
<form onSubmit={onSubmit} className="grid grid-cols-1 sm:grid-cols-2 gap-x-5 gap-y-5">
<label className="flex flex-col gap-1.5">
<span className={labelCls} style={labelStyle}>Vorname *</span>
<input required value={form.firstName} onChange={(e) => set("firstName", e.target.value)} className={inputCls} style={inputStyle} suppressHydrationWarning />
</label>
<label className="flex flex-col gap-1.5">
<span className={labelCls} style={labelStyle}>Nachname *</span>
<input required value={form.lastName} onChange={(e) => set("lastName", e.target.value)} className={inputCls} style={inputStyle} suppressHydrationWarning />
</label>
<label className="flex flex-col gap-1.5">
<span className={labelCls} style={labelStyle}>Firmenname</span>
<input value={form.company} onChange={(e) => set("company", e.target.value)} className={inputCls} style={inputStyle} suppressHydrationWarning />
</label>
<label className="flex flex-col gap-1.5">
<span className={labelCls} style={labelStyle}>Branche</span>
<input value={form.industry} onChange={(e) => set("industry", e.target.value)} placeholder="z. B. Sanitär / Heizung" className={inputCls} style={inputStyle} suppressHydrationWarning />
</label>
<label className="flex flex-col gap-1.5">
<span className={labelCls} style={labelStyle}>E-Mail *</span>
<input required type="email" value={form.email} onChange={(e) => set("email", e.target.value)} className={inputCls} style={inputStyle} suppressHydrationWarning />
</label>
<label className="flex flex-col gap-1.5">
<span className={labelCls} style={labelStyle}>Telefonnummer</span>
<input type="tel" value={form.phone} onChange={(e) => set("phone", e.target.value)} className={inputCls} style={inputStyle} suppressHydrationWarning />
</label>
<label className="flex flex-col gap-1.5 sm:col-span-2">
<span className={labelCls} style={labelStyle}>Worum geht’s dir? *</span>
<textarea
required
rows={4}
value={form.message}
onChange={(e) => set("message", e.target.value)}
placeholder="Kurz dein Anliegen, wir kümmern uns um die Details."
className="w-full rounded-lg px-3.5 py-3 text-[15px] outline-none resize-y transition-shadow focus:ring-2 focus:ring-[var(--accent-yellow)]"
style={inputStyle}
/>
</label>
{state === "err" && (
<p className="sm:col-span-2 text-[13px] font-medium" style={{ color: "#EF4444" }}>
{errMsg}
</p>
)}
<div className="sm:col-span-2 mt-1 flex flex-wrap items-center justify-between gap-x-5 gap-y-3">
<p className="text-[12.5px] leading-relaxed" style={{ color: "var(--text-tertiary)", maxWidth: 340 }}>
Mit dem Absenden stimmst du der Verarbeitung deiner Angaben gemäß der{" "}
<Link href="/datenschutz" className="underline hover:no-underline" style={{ color: "var(--text-secondary)" }}>
Datenschutzerklärung
</Link>{" "}
zu.
</p>
<DemoButton type="submit" disabled={state === "loading"}>
{state === "loading" ? "Sende …" : submitLabel}
</DemoButton>
</div>
</form>
</div>
);
}