import React, { useEffect, useRef, useState } from 'react'; interface RevealProps { children: React.ReactNode; className?: string; delay?: number; duration?: number; threshold?: number; } export const Reveal: React.FC = ({ children, className = "", delay = 0, duration = 1000, threshold = 0.1 }) => { const ref = useRef(null); const [isVisible, setIsVisible] = useState(false); useEffect(() => { const observer = new IntersectionObserver( ([entry]) => { if (entry.isIntersecting) { setIsVisible(true); observer.disconnect(); } }, { threshold, rootMargin: "50px" } ); if (ref.current) { observer.observe(ref.current); } return () => observer.disconnect(); }, [threshold]); return (
{children}
); };