'use client'; import React, { useEffect, useRef, useState } from 'react'; import { cn } from '@/components/ui'; interface RevealProps { children: React.ReactNode; className?: string; threshold?: number; delay?: number; } export default function Reveal({ children, className, threshold = 0.1, delay = 0 }: RevealProps) { const [isVisible, setIsVisible] = useState(false); const ref = useRef(null); useEffect(() => { const observer = new IntersectionObserver( ([entry]) => { if (entry.isIntersecting) { setIsVisible(true); observer.unobserve(entry.target); } }, { threshold } ); if (ref.current) { observer.observe(ref.current); } return () => { if (ref.current) { observer.unobserve(ref.current); } }; }, [threshold]); return (
{children}
); }