import { useEffect, useRef } from "react"; import useInViewAnimation from "./useInViewAnimation"; import Button from "./Button"; import DocCard from "./DocCards"; import Logo from "../Logo"; import "./sections.css"; /* Mouse-trail spawns mini document mockups, cloned from a hidden pool of DocCards (React renders the pool once; the trail clones plain DOM). */ const TRAIL_VARIANTS = [ "invoice", "packing", "report", "declaration", "answer", "certificate", ]; const SPAWN_INTERVAL_MS = 80; const TRAIL_LIFETIME_MS = 1000; // Big white rounded container with a mouse-trail DocCard spawner, serif // heading, and one dark logo-pill CTA. Trail is throttled to 80ms, cleaned // up on unmount, and fully disabled under prefers-reduced-motion. export default function PartnerSection({ onGetStarted }) { const [ref, inView] = useInViewAnimation(); const boxRef = useRef(null); const poolRef = useRef(null); useEffect(() => { const box = boxRef.current; const pool = poolRef.current; if (!box || !pool) return undefined; const reduced = window.matchMedia("(prefers-reduced-motion: reduce)"); let lastSpawn = 0; let cardIndex = 0; const live = new Set(); const timers = new Set(); const onMove = (e) => { if (reduced.matches) return; const protos = pool.children; if (!protos.length) return; const now = performance.now(); if (now - lastSpawn < SPAWN_INTERVAL_MS) return; lastSpawn = now; const rect = box.getBoundingClientRect(); // Clone a prototype DocCard (static markup, no handlers — safe to clone). const card = protos[cardIndex % protos.length].cloneNode(true); cardIndex += 1; card.classList.add("st-trail-card"); card.style.left = `${e.clientX - rect.left}px`; card.style.top = `${e.clientY - rect.top}px`; card.style.setProperty("--st-rot", `${(Math.random() * 20 - 10).toFixed(1)}deg`); box.appendChild(card); live.add(card); const t = window.setTimeout(() => { card.remove(); live.delete(card); timers.delete(t); }, TRAIL_LIFETIME_MS); timers.add(t); }; box.addEventListener("mousemove", onMove); return () => { box.removeEventListener("mousemove", onMove); timers.forEach((t) => window.clearTimeout(t)); live.forEach((card) => card.remove()); }; }, []); return (
{/* Hidden prototypes the mouse-trail clones from (never displayed). */}

Partner with Tamga

); }