import "./index.css" import { useEffect, useRef, useState } from "react" import { SectionNav } from "./components/SectionNav" import { Header } from "./components/sections/Header" import { Work } from "./components/sections/Work" import { Connect } from "./components/sections/Connect" import { sections } from "./data/portfolio" export function App() { const [activeSection, setActiveSection] = useState("") const sectionsRef = useRef<(HTMLElement | null)[]>([]) useEffect(() => { const observer = new IntersectionObserver( (entries) => { entries.forEach((entry) => { if (entry.isIntersecting) { entry.target.classList.add("animate-fade-in-up") setActiveSection(entry.target.id) } }) }, { threshold: 0.1, rootMargin: "0px 0px -5% 0px" }, ) sectionsRef.current.forEach((section) => { if (section) observer.observe(section) }) return () => observer.disconnect() }, []) return (
(sectionsRef.current[0] = el)} />
(sectionsRef.current[1] = el)} /> (sectionsRef.current[2] = el)} />
) } export default App