chore(repo): sync wireframe structure and references
This commit is contained in:
1 parent
05d2d5777f
commit
d953a79e95
453 files changed
+36639
-621
No files matched your search
@@ -0,0 +1,64 @@
|
||||
import Link from "next/link";
|
||||
import { CHAMFER } from "@/lib/chamfer";
|
||||
import DemoButton from "@/components/ui/DemoButton";
|
||||
|
||||
interface CTABannerProps {
|
||||
headline: string;
|
||||
sub: string;
|
||||
primaryLabel?: string;
|
||||
primaryHref?: string;
|
||||
secondaryLabel?: string;
|
||||
secondaryHref?: string;
|
||||
}
|
||||
|
||||
export default function CTABanner({
|
||||
headline,
|
||||
sub,
|
||||
primaryLabel = "Auf die Warteliste",
|
||||
primaryHref = "/waitlist",
|
||||
secondaryLabel = "Kontakt",
|
||||
secondaryHref = "/kontakt",
|
||||
}: CTABannerProps) {
|
||||
return (
|
||||
<section
|
||||
className="section-full"
|
||||
style={{ background: "var(--surface)", paddingBlock: 80 }}
|
||||
>
|
||||
<div className="mx-auto" style={{ maxWidth: "var(--content-width)" }}>
|
||||
<div
|
||||
className="flex flex-col lg:flex-row items-center justify-between gap-8"
|
||||
style={{ background: "var(--dark-bg)", padding: "56px 64px", clipPath: CHAMFER }}
|
||||
>
|
||||
{/* Text */}
|
||||
<div className="flex flex-col gap-4 w-full lg:max-w-lg">
|
||||
<h2
|
||||
className="text-[28px] md:text-[36px] font-bold leading-[1.2]"
|
||||
style={{ color: "#FFFFFF" }}
|
||||
>
|
||||
{headline}
|
||||
</h2>
|
||||
<p className="text-[16px] leading-relaxed" style={{ color: "#A3ACBA" }}>
|
||||
{sub}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Buttons */}
|
||||
<div className="flex flex-wrap gap-3 shrink-0">
|
||||
<DemoButton href={primaryHref}>{primaryLabel}</DemoButton>
|
||||
<Link
|
||||
href={secondaryHref}
|
||||
className="inline-flex items-center justify-center rounded-[var(--radius-button)] text-[16px] font-semibold hover:bg-white/10 transition-colors"
|
||||
style={{
|
||||
color: "#FFFFFF",
|
||||
padding: "14px 28px",
|
||||
border: "1px solid #FFFFFF",
|
||||
}}
|
||||
>
|
||||
{secondaryLabel}
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
"use client";
|
||||
|
||||
import { useRef, useState, useEffect, useCallback } from "react";
|
||||
|
||||
/* ──────────────────────────────────────────────────────────────────────────
|
||||
* CanvasHint — the small centred onboarding popup shared by the interactive
|
||||
* product demos (workflow editor, kanban, approval inbox, email builder). It
|
||||
* shows a looping "drag" micro-animation, a title and a one-line subtitle, and
|
||||
* a close button. Designed to sit inside a `position: relative` dotted-grid
|
||||
* canvas container.
|
||||
*
|
||||
* useCanvasHint() drives it: the hint appears once its container scrolls into
|
||||
* view and is dismissed on the first real interaction (or via the X).
|
||||
* ────────────────────────────────────────────────────────────────────────── */
|
||||
|
||||
const HINT_CSS = `
|
||||
@keyframes hint-popup-in{from{opacity:0;transform:scale(0.95)}to{opacity:1;transform:scale(1)}}
|
||||
@keyframes hint-mini-drag{0%,100%{transform:translate(0,0)}20%{transform:translate(0,-4px)}40%{transform:translate(34px,-4px)}60%{transform:translate(34px,0)}80%{transform:translate(0,0)}}
|
||||
@keyframes hint-mini-cursor{0%,15%{transform:translate(38px,24px)}20%{transform:translate(22px,16px)}40%,60%{transform:translate(58px,16px)}65%{transform:translate(60px,24px)}80%,100%{transform:translate(38px,24px)}}
|
||||
.hint-mini-drag{animation:hint-mini-drag 3s ease-in-out infinite}
|
||||
.hint-mini-cursor{animation:hint-mini-cursor 3s ease-in-out infinite}
|
||||
@media (prefers-reduced-motion:reduce){.hint-mini-drag,.hint-mini-cursor{animation:none}}
|
||||
`;
|
||||
|
||||
export function useCanvasHint<T extends HTMLElement>() {
|
||||
const ref = useRef<T | null>(null);
|
||||
const [show, setShow] = useState(false);
|
||||
const dismissed = useRef(false);
|
||||
|
||||
useEffect(() => {
|
||||
const el = ref.current;
|
||||
if (!el || dismissed.current) return;
|
||||
const obs = new IntersectionObserver(
|
||||
(entries) => entries.forEach((e) => { if (e.isIntersecting && !dismissed.current) setShow(true); }),
|
||||
{ threshold: 0.4 }
|
||||
);
|
||||
obs.observe(el);
|
||||
return () => obs.disconnect();
|
||||
}, []);
|
||||
|
||||
const dismiss = useCallback(() => {
|
||||
dismissed.current = true;
|
||||
setShow(false);
|
||||
}, []);
|
||||
|
||||
return { ref, show, dismiss };
|
||||
}
|
||||
|
||||
export default function CanvasHint({
|
||||
show,
|
||||
onDismiss,
|
||||
title,
|
||||
subtitle,
|
||||
}: {
|
||||
show: boolean;
|
||||
onDismiss: () => void;
|
||||
title: string;
|
||||
subtitle: string;
|
||||
}) {
|
||||
if (!show) return null;
|
||||
// z-[45] sits above canvas content (EmailBuilder reset btn z-40) but below the
|
||||
// navbar (header z-50 / its dropdown), so the hint never floats over the
|
||||
// expanded nav.
|
||||
return (
|
||||
<div data-canvas-hint className="absolute inset-0 z-[45] flex items-center justify-center" style={{ pointerEvents: "none" }}>
|
||||
<style dangerouslySetInnerHTML={{ __html: HINT_CSS }} />
|
||||
<div
|
||||
className="relative flex flex-col items-center gap-3 rounded-2xl px-8 py-6"
|
||||
style={{
|
||||
background: "rgba(255,255,255,0.97)",
|
||||
border: "1px solid var(--border-light)",
|
||||
boxShadow: "0 12px 40px rgba(0,0,0,0.12)",
|
||||
animation: "hint-popup-in 0.3s ease both",
|
||||
pointerEvents: "auto",
|
||||
}}
|
||||
>
|
||||
<button
|
||||
onClick={onDismiss}
|
||||
aria-label="Hinweis schließen"
|
||||
className="absolute top-2.5 right-2.5 w-6 h-6 rounded-md flex items-center justify-center hover:bg-[var(--bg-muted)] transition-colors"
|
||||
style={{ color: "var(--text-muted)" }}
|
||||
>
|
||||
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round">
|
||||
<path d="M2 2l8 8M10 2l-8 8" />
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
{/* Mini drag micro-animation */}
|
||||
<div className="relative" style={{ width: 90, height: 50 }}>
|
||||
<div className="hint-mini-drag" style={{ width: 36, height: 24, borderRadius: 6, border: "2px solid #B0B8C4", background: "#F3F4F6", position: "absolute", top: 8, left: 6 }} />
|
||||
<div style={{ width: 36, height: 24, borderRadius: 6, border: "2px solid var(--accent-yellow)", background: "var(--accent-yellow-light)", position: "absolute", top: 16, left: 44, opacity: 0.5 }} />
|
||||
<svg className="hint-mini-cursor" width="16" height="16" viewBox="0 0 24 24" fill="none" style={{ position: "absolute" }}>
|
||||
<path d="M5 3l14 8-6 2-4 6z" fill="#1A1A1A" stroke="white" strokeWidth="1.5" />
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
<span className="text-[15px] font-semibold" style={{ color: "var(--text-primary)" }}>{title}</span>
|
||||
<span className="text-[12px]" style={{ color: "var(--text-muted)" }}>{subtitle}</span>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,227 @@
|
||||
import Link from "next/link";
|
||||
import { CHAMFER } from "@/lib/chamfer";
|
||||
import type { ReactNode } from "react";
|
||||
import DemoButton from "@/components/ui/DemoButton";
|
||||
import { AnimatedDavidCard } from "@/app/ueber-uns/TeamCards";
|
||||
|
||||
/* ──────────────────────────────────────────────────────────────────────────
|
||||
* CTA banner with three interchangeable right-side visuals. Shared by the
|
||||
* landing page and the product pages so each surface can pick the variant
|
||||
* that fits (not the same one everywhere):
|
||||
* - "hex": honeycomb texture (abstract brand)
|
||||
* - "portrait": David-portrait frame (human touch)
|
||||
* - "kanban": kanban board preview (product peek / pipeline)
|
||||
* ────────────────────────────────────────────────────────────────────────── */
|
||||
|
||||
export type CtaVariant = "hex" | "portrait" | "kanban";
|
||||
|
||||
function HexRightArt() {
|
||||
// Brand honeycomb graphic over the text-free right area. Two layers:
|
||||
// 1. the honeycomb (public/cta-honeycomb.svg) at uniform strength
|
||||
// 2. a navy background that fades in from the right (0%) to the left (100%),
|
||||
// revealing the honeycomb progressively toward the right.
|
||||
return (
|
||||
<div className="absolute inset-0 pointer-events-none" aria-hidden>
|
||||
<div
|
||||
className="absolute inset-0"
|
||||
style={{
|
||||
backgroundImage: "url(/cta-honeycomb.svg)",
|
||||
backgroundSize: "auto 120%",
|
||||
backgroundPosition: "center right",
|
||||
backgroundRepeat: "repeat-x",
|
||||
opacity: 1,
|
||||
}}
|
||||
/>
|
||||
<div
|
||||
className="absolute inset-0"
|
||||
style={{
|
||||
background:
|
||||
"linear-gradient(90deg, var(--dark-bg) 0%, var(--dark-bg) 40%, transparent 100%)",
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function PortraitRightArt() {
|
||||
return (
|
||||
<div className="relative shrink-0 hidden lg:block" aria-hidden>
|
||||
<AnimatedDavidCard />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// Mini priority flag — same mark as the projektmanagement KanbanBoard, lighter
|
||||
// tints so it reads on the dark CTA background.
|
||||
function MiniFlag({ priority }: { priority: "high" | "medium" | "low" }) {
|
||||
const color = priority === "high" ? "#F87171" : priority === "medium" ? "#F1B729" : "rgba(255,255,255,0.35)";
|
||||
return (
|
||||
<svg width="11" height="11" viewBox="0 0 24 24" fill={color} stroke={color} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className="shrink-0">
|
||||
<path d="M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z" />
|
||||
<line x1="4" y1="22" x2="4" y2="15" />
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
function KanbanRightArt() {
|
||||
const columns = [
|
||||
{
|
||||
title: "Angebote",
|
||||
accent: "#93C5FD",
|
||||
cards: [
|
||||
{ title: "Sanitär Neubau · Weber", tag: "Neu", tagColor: "#93C5FD", priority: "high" as const, value: "€ 42.500", initials: "MW" },
|
||||
{ title: "Heizung Modernis. · Berg", tag: "Follow-up", tagColor: "#F1B729", priority: "medium" as const, value: "€ 18.900", initials: "LK" },
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "Baustellen",
|
||||
accent: "#F1B729",
|
||||
cards: [
|
||||
{ title: "Solarcarport · Linnich", tag: "Planung", tagColor: "#F1B729", priority: "high" as const, value: "€ 73.800", initials: "AW" },
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "Abgeschlossen",
|
||||
accent: "#4ADE80",
|
||||
cards: [
|
||||
{ title: "Wartung Müller", tag: "OK", tagColor: "#4ADE80", priority: "low" as const, value: "12 Anlagen", initials: "SM" },
|
||||
{ title: "Bad Renov. Fischer", tag: "Abgenommen", tagColor: "#4ADE80", priority: "low" as const, value: "€ 24.300", initials: "TB" },
|
||||
],
|
||||
},
|
||||
];
|
||||
return (
|
||||
<div className="relative hidden lg:flex flex-col gap-2 shrink-0" style={{ width: 380 }} aria-hidden>
|
||||
<span
|
||||
className="self-end text-[9px] font-semibold uppercase tracking-wider rounded-full mb-0.5"
|
||||
style={{ padding: "2px 8px", background: "rgba(255,255,255,0.08)", color: "rgba(255,255,255,0.55)", border: "1px solid rgba(255,255,255,0.12)" }}
|
||||
>
|
||||
Beispielansicht
|
||||
</span>
|
||||
<div className="grid grid-cols-3 gap-2.5">
|
||||
{columns.map((col) => (
|
||||
<div key={col.title} className="flex flex-col gap-2">
|
||||
<div className="flex items-center gap-1.5 pb-1">
|
||||
<span className="inline-block" style={{ width: 6, height: 6, borderRadius: 2, background: col.accent }} />
|
||||
<span className="text-[10.5px] font-bold uppercase tracking-wider" style={{ color: "rgba(255,255,255,0.75)" }}>
|
||||
{col.title}
|
||||
</span>
|
||||
</div>
|
||||
{col.cards.map((card, i) => (
|
||||
// Same card anatomy as the projektmanagement board: tag + priority
|
||||
// flag row, prominent title, footer with an avatar and a chip —
|
||||
// just re-coloured for the dark banner.
|
||||
<div
|
||||
key={i}
|
||||
className="flex flex-col gap-1.5"
|
||||
style={{
|
||||
background: "rgba(255,255,255,0.05)",
|
||||
border: "1px solid rgba(255,255,255,0.08)",
|
||||
borderRadius: 10,
|
||||
padding: "9px 10px",
|
||||
}}
|
||||
>
|
||||
{/* Row 1: tag · priority flag */}
|
||||
<div className="flex items-start justify-between gap-1.5">
|
||||
<span
|
||||
className="inline-flex text-[8.5px] font-bold uppercase tracking-wider px-1.5 py-0.5 rounded self-start"
|
||||
style={{ background: `${card.tagColor}26`, color: card.tagColor, border: `1px solid ${card.tagColor}40` }}
|
||||
>
|
||||
{card.tag}
|
||||
</span>
|
||||
<MiniFlag priority={card.priority} />
|
||||
</div>
|
||||
|
||||
{/* Title */}
|
||||
<span className="text-[11.5px] font-semibold leading-tight" style={{ color: "#fff" }}>
|
||||
{card.title}
|
||||
</span>
|
||||
|
||||
{/* Footer: avatar · value chip */}
|
||||
<div className="flex items-center justify-between gap-1.5 pt-1.5" style={{ borderTop: "1px solid rgba(255,255,255,0.08)" }}>
|
||||
<span
|
||||
className="grid place-items-center rounded-full shrink-0 text-[8px] font-bold"
|
||||
style={{ width: 18, height: 18, background: "rgba(255,255,255,0.1)", color: "rgba(255,255,255,0.85)", boxShadow: "0 0 0 1.5px var(--dark-bg)" }}
|
||||
>
|
||||
{card.initials}
|
||||
</span>
|
||||
<span
|
||||
className="text-[9px] font-semibold rounded px-1.5 py-0.5"
|
||||
style={{ background: "rgba(255,255,255,0.06)", color: "rgba(255,255,255,0.65)" }}
|
||||
>
|
||||
{card.value}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default function CtaBanner({
|
||||
headline,
|
||||
sub,
|
||||
variant = "hex",
|
||||
ctaLabel = "Auf die Warteliste",
|
||||
}: {
|
||||
headline: ReactNode;
|
||||
sub: string;
|
||||
variant?: CtaVariant;
|
||||
ctaLabel?: string;
|
||||
}) {
|
||||
const compactPortraitSpacing = variant === "portrait";
|
||||
|
||||
return (
|
||||
<section
|
||||
className="section-full"
|
||||
style={{
|
||||
background: "var(--surface)",
|
||||
paddingBlock: compactPortraitSpacing ? 72 : 80,
|
||||
}}
|
||||
>
|
||||
<div className="mx-auto" style={{ maxWidth: "var(--content-width)" }}>
|
||||
<div
|
||||
className="relative flex flex-col lg:flex-row items-center justify-between gap-10 overflow-hidden"
|
||||
style={{
|
||||
background: "var(--dark-bg)",
|
||||
padding: compactPortraitSpacing ? "64px 72px" : "72px 72px",
|
||||
minHeight: 380,
|
||||
clipPath: CHAMFER,
|
||||
}}
|
||||
>
|
||||
{/* Variant-specific right-side art (hex is absolute-full, others sit inline) */}
|
||||
{variant === "hex" && <HexRightArt />}
|
||||
|
||||
{/* Text block */}
|
||||
<div className="relative z-10 flex flex-col gap-4 w-full lg:max-w-lg">
|
||||
<h2
|
||||
className="font-extrabold leading-tight"
|
||||
style={{ color: "#FFFFFF", fontSize: "clamp(28px, 3.4vw, 42px)", letterSpacing: "-0.02em" }}
|
||||
>
|
||||
{headline}
|
||||
</h2>
|
||||
<p className="text-[16px] leading-relaxed" style={{ color: "#A3ACBA" }}>
|
||||
{sub}
|
||||
</p>
|
||||
<div className="flex flex-wrap gap-3 mt-2">
|
||||
<DemoButton href="/waitlist">{ctaLabel}</DemoButton>
|
||||
<Link
|
||||
href="/kontakt"
|
||||
className="inline-flex items-center justify-center rounded-[var(--radius-button)] text-[16px] font-semibold hover:bg-white/10 transition-colors"
|
||||
style={{ color: "#FFFFFF", padding: "14px 28px", border: "1px solid #FFFFFF" }}
|
||||
>
|
||||
Kontakt
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Non-hex variants: inline art on the right */}
|
||||
{variant === "portrait" && <PortraitRightArt />}
|
||||
{variant === "kanban" && <KanbanRightArt />}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
"use client";
|
||||
|
||||
/* ═══════════════════════════════════════════════════════════════════════
|
||||
DemoButton — Gelber Wave-Button mit Dark Charcoal Wave, Shimmer, Scale
|
||||
Basiert auf der freigegebenen Medium-Throw-Variante (0,8 s)
|
||||
|
||||
Rendert standardmäßig einen <Link> (Navigation). Mit `type` ("submit" |
|
||||
"button") rendert er stattdessen einen <button> — für Formular-Buttons
|
||||
(Lead-Formular, Newsletter) mit derselben Animation.
|
||||
═══════════════════════════════════════════════════════════════════════ */
|
||||
|
||||
import Link from "next/link";
|
||||
import { useRef, useCallback } from "react";
|
||||
import { gsap } from "gsap/dist/gsap";
|
||||
|
||||
const WAVE_CSS = `
|
||||
.demo-btn .demo-wl{transform:translateX(-50%) translateY(100%);border-radius:999px 999px 0 0;transition:none}
|
||||
.demo-btn:hover .demo-wl{transform:translateX(-50%) translateY(10px);border-radius:60% 60% 0 0}
|
||||
.demo-btn:hover .demo-wl-1{transition:transform .55s cubic-bezier(.19,1,.22,1) 80ms,border-radius .15s cubic-bezier(.19,1,.22,1) 100ms}
|
||||
.demo-btn:hover .demo-wl-2{transition:transform .55s cubic-bezier(.19,1,.22,1) 150ms,border-radius .15s cubic-bezier(.19,1,.22,1) 200ms}
|
||||
.demo-btn:hover .demo-wl-3{transition:transform .55s cubic-bezier(.19,1,.22,1) 220ms,border-radius .15s cubic-bezier(.19,1,.22,1) 300ms}
|
||||
.demo-btn .demo-txt-out{transform:translateY(0);opacity:1;transition:none}
|
||||
.demo-btn:hover .demo-txt-out{transform:translateY(-80%);opacity:0;transition:transform .8s cubic-bezier(.32,.99,.49,.99),opacity .3s ease}
|
||||
.demo-btn .demo-txt-in{transform:translateY(80%);opacity:0;transition:none}
|
||||
.demo-btn:hover .demo-txt-in{transform:translateY(0);opacity:1;transition:all .8s cubic-bezier(.32,.99,.49,.99)}
|
||||
`;
|
||||
|
||||
const SHIMMER_CSS = `
|
||||
@keyframes demo-shimmer{0%,75%{transform:translateX(-120%)}85%{transform:translateX(220%)}100%{transform:translateX(220%)}}
|
||||
`;
|
||||
|
||||
const sizes = {
|
||||
default: { padding: "14px 28px", fontSize: "16px", border: "1.5px solid transparent" },
|
||||
sm: { padding: "10px 14px", fontSize: "14px", border: "none" },
|
||||
} as const;
|
||||
|
||||
type SizeKey = keyof typeof sizes;
|
||||
|
||||
// Colour variants — same wave/shimmer/text-swap mechanics, different palette.
|
||||
// "amber" is the default hero button; "neutral" waves from a light grey base to
|
||||
// dark charcoal (for subdued CTAs that should share the effect without stealing
|
||||
// the amber hero's prominence).
|
||||
const variants = {
|
||||
amber: {
|
||||
base: "var(--accent-yellow)",
|
||||
w1: "#0F1A2E", w2: "var(--accent-yellow-dark)", w3: "var(--accent-yellow)",
|
||||
textOut: "var(--text-primary)", textIn: "var(--text-primary)",
|
||||
},
|
||||
neutral: {
|
||||
base: "var(--bg-muted)",
|
||||
w1: "#1A1A1A", w2: "var(--dark-bg)", w3: "var(--dark-bg)",
|
||||
textOut: "var(--text-primary)", textIn: "#FFFFFF",
|
||||
},
|
||||
} as const;
|
||||
|
||||
type VariantKey = keyof typeof variants;
|
||||
|
||||
export default function DemoButton({
|
||||
href = "/waitlist",
|
||||
children = "Auf die Warteliste",
|
||||
size = "default",
|
||||
className = "",
|
||||
onClick,
|
||||
type,
|
||||
disabled = false,
|
||||
fullWidth = false,
|
||||
variant = "amber",
|
||||
}: {
|
||||
href?: string;
|
||||
children?: React.ReactNode;
|
||||
size?: SizeKey;
|
||||
className?: string;
|
||||
onClick?: () => void;
|
||||
/** When set, renders a <button type=…> (form submit) instead of a <Link>. */
|
||||
type?: "submit" | "button";
|
||||
disabled?: boolean;
|
||||
/** Stretch the button to fill its container (e.g. a card CTA). */
|
||||
fullWidth?: boolean;
|
||||
/** Colour palette — "amber" (hero) or "neutral" (subdued grey→charcoal). */
|
||||
variant?: VariantKey;
|
||||
}) {
|
||||
const scaleRef = useRef<HTMLDivElement>(null);
|
||||
const s = sizes[size];
|
||||
const v = variants[variant];
|
||||
|
||||
const onEnter = useCallback(() => {
|
||||
if (scaleRef.current) gsap.to(scaleRef.current, { scale: 1.04, duration: 0.3, ease: "power2.out" });
|
||||
}, []);
|
||||
const onLeave = useCallback(() => {
|
||||
if (scaleRef.current) gsap.to(scaleRef.current, { scale: 1, duration: 0.4, ease: "power2.inOut" });
|
||||
}, []);
|
||||
|
||||
// Shared inner content (wave layers + text swap) for both Link and button.
|
||||
const inner = (
|
||||
<>
|
||||
{/* Background + wave layers */}
|
||||
<div
|
||||
className="absolute inset-0 overflow-hidden transition-transform duration-[1500ms] group-hover:scale-[0.94]"
|
||||
style={{
|
||||
background: v.base,
|
||||
borderRadius: "var(--radius-button)",
|
||||
transitionTimingFunction: "cubic-bezier(.19,1,.22,1)",
|
||||
}}
|
||||
>
|
||||
<span className="demo-wl demo-wl-1 absolute bottom-0 left-1/2 z-[2] block" style={{ width: "120%", height: "200%", background: v.w1 }} />
|
||||
<span className="demo-wl demo-wl-2 absolute bottom-0 left-1/2 z-[3] block" style={{ width: "120%", height: "200%", background: v.w2 }} />
|
||||
<span className="demo-wl demo-wl-3 absolute bottom-0 left-1/2 z-[4] block" style={{ width: "120%", height: "200%", background: v.w3 }} />
|
||||
</div>
|
||||
|
||||
{/* Text out */}
|
||||
<span className="demo-txt-out relative z-10" style={{ color: v.textOut }}>{children}</span>
|
||||
{/* Text in */}
|
||||
<span className="demo-txt-in absolute inset-0 z-10 flex items-center justify-center" style={{ color: v.textIn }}>{children}</span>
|
||||
</>
|
||||
);
|
||||
|
||||
const contentClass = `demo-btn group relative ${fullWidth ? "flex w-full" : "inline-flex"} items-center justify-center overflow-hidden font-semibold text-[var(--text-primary)]`;
|
||||
const contentStyle = {
|
||||
padding: s.padding,
|
||||
fontSize: s.fontSize,
|
||||
border: s.border,
|
||||
borderRadius: "var(--radius-button)",
|
||||
opacity: disabled ? 0.6 : undefined,
|
||||
} as const;
|
||||
|
||||
return (
|
||||
<>
|
||||
<style dangerouslySetInnerHTML={{ __html: WAVE_CSS + SHIMMER_CSS }} />
|
||||
<div
|
||||
ref={scaleRef}
|
||||
onMouseEnter={onEnter}
|
||||
onMouseLeave={onLeave}
|
||||
className={`${fullWidth ? "flex w-full" : "inline-flex"} ${className}`}
|
||||
>
|
||||
<div className={`relative ${fullWidth ? "flex w-full" : "inline-flex"} overflow-hidden rounded-[var(--radius-button)]`}>
|
||||
{type ? (
|
||||
<button
|
||||
type={type}
|
||||
disabled={disabled}
|
||||
onClick={onClick}
|
||||
className={contentClass}
|
||||
style={contentStyle}
|
||||
>
|
||||
{inner}
|
||||
</button>
|
||||
) : (
|
||||
<Link href={href} onClick={onClick} className={contentClass} style={contentStyle}>
|
||||
{inner}
|
||||
</Link>
|
||||
)}
|
||||
|
||||
{/* Shimmer overlay */}
|
||||
<div
|
||||
className="pointer-events-none absolute inset-y-0 z-20 w-[40%]"
|
||||
style={{
|
||||
background: "linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent)",
|
||||
animation: "demo-shimmer 4s ease-in-out infinite",
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -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>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user