"use client" import { useEffect, useRef, useState } from "react" interface SectionHeaderProps { title: string subtitle?: string className?: string } export function SectionHeader({ title, subtitle, className = "" }: SectionHeaderProps) { const [isVisible, setIsVisible] = useState(false) const [isSticky, setIsSticky] = useState(false) const headerRef = useRef(null) useEffect(() => { const observer = new IntersectionObserver( ([entry]) => { setIsVisible(entry.isIntersecting) }, { threshold: 0.1 }, ) const stickyObserver = new IntersectionObserver( ([entry]) => { setIsSticky(!entry.isIntersecting) }, { rootMargin: "-80px 0px 0px 0px" }, ) if (headerRef.current) { observer.observe(headerRef.current) stickyObserver.observe(headerRef.current) } return () => { observer.disconnect() stickyObserver.disconnect() } }, []) return (

{title}

{subtitle &&

{subtitle}

}
) }