'use client'; import { useEffect, useRef, useState, ReactNode } from 'react'; import clsx from 'clsx'; interface SectionDividerProps { children: ReactNode; className?: string; } export function SectionDivider({ children, className }: SectionDividerProps) { const ref = useRef(null); const [visible, setVisible] = useState(false); useEffect(() => { const el = ref.current; if (!el) return; if (!('IntersectionObserver' in window)) { setVisible(true); return; } const observer = new IntersectionObserver( (entries) => { entries.forEach((entry) => { if (entry.isIntersecting) { setVisible(true); } }); }, { threshold: 0.15, rootMargin: '0px 0px -20% 0px' } ); observer.observe(el); return () => observer.disconnect(); }, []); return (
{children}
); }