feat(docs): add animated product website

This commit is contained in:
2026-07-16 16:38:30 +02:00
parent e40a4bfee2
commit d61d6f3c5b
38 changed files with 12046 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
"use client";
import type { CSSProperties, ReactNode } from "react";
import { useEffect, useRef } from "react";
type RevealProps = {
children: ReactNode;
className?: string;
delay?: number;
};
export function Reveal({ children, className = "", delay = 0 }: RevealProps) {
const targetRef = useRef<HTMLDivElement>(null);
useEffect(() => {
const root = document.documentElement;
root.classList.add("motion-ready");
const target = targetRef.current;
if (!target) return;
const reduceMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
if (reduceMotion || !("IntersectionObserver" in window)) {
target.classList.add("is-visible");
return;
}
const observer = new IntersectionObserver(
(entries) => {
entries.forEach((entry) => {
if (!entry.isIntersecting) return;
entry.target.classList.add("is-visible");
observer.unobserve(entry.target);
});
},
{ rootMargin: "0px 0px -10%", threshold: 0.08 },
);
observer.observe(target);
return () => observer.disconnect();
}, []);
return (
<div
ref={targetRef}
className={`reveal ${className}`.trim()}
data-reveal
style={{ "--reveal-delay": `${delay}ms` } as CSSProperties}
>
{children}
</div>
);
}