Download frontend/src/components/landing/PartnerSection.jsx from tamgaa/app: direct link, hf CLI and curl.
- Browser
- Download file 3.54 kB
-
https://huggingface.co/spaces/tamgaa/app/resolve/main/frontend/src/components/landing/PartnerSection.jsx
- Command line
-
hf download hf://spaces/tamgaa/app/frontend/src/components/landing/PartnerSection.jsx
-
curl -L -o PartnerSection.jsx https://huggingface.co/spaces/tamgaa/app/resolve/main/frontend/src/components/landing/PartnerSection.jsx
3.54 kB
| 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 ( | |
| <section id="about" className="st-partner" aria-label="Partner with Tamga"> | |
| <div className="st-partner-box" ref={boxRef}> | |
| {/* Hidden prototypes the mouse-trail clones from (never displayed). */} | |
| <div ref={poolRef} className="st-trail-pool" aria-hidden="true"> | |
| {TRAIL_VARIANTS.map((v) => ( | |
| <DocCard key={v} variant={v} /> | |
| ))} | |
| </div> | |
| <div ref={ref}> | |
| <h2 | |
| className={`st-partner-h st-serif ${inView ? "st-fade-up" : "st-hidden"}`} | |
| style={{ animationDelay: "0.1s" }} | |
| > | |
| Partner with Tamga | |
| </h2> | |
| <div | |
| className={`st-partner-cta ${inView ? "st-fade-up" : "st-hidden"}`} | |
| style={{ animationDelay: "0.2s" }} | |
| > | |
| <Button variant="primary" onClick={onGetStarted} ariaLabel="Start free pilot"> | |
| <span className="st-partner-avatar" aria-hidden="true"> | |
| <Logo size={22} /> | |
| </span> | |
| Start free pilot | |
| </Button> | |
| </div> | |
| </div> | |
| </div> | |
| </section> | |
| ); | |
| } | |