import React, { useEffect, useMemo, useRef, useState } from "react"; import { Navbar } from "./components/Navbar"; import { Section } from "./components/Section"; import { Hero } from "./components/Hero"; import { Projects } from "./components/Projects"; import { Resume } from "./components/Resume"; import { Footer } from "./components/Footer"; import { AboutMe } from "./components/AboutMe"; export default function App() { const sections = useMemo(() => ["home", "about", "projects", "experience"], []); const refs = useRef>({}); const [active, setActive] = useState(sections[0]); useEffect(() => { const map: Record = {}; sections.forEach((id) => (map[id] = document.getElementById(id))); refs.current = map; const io = new IntersectionObserver( (entries) => { entries.forEach((e) => { if (e.isIntersecting) setActive(e.target.id); }); }, { rootMargin: "-40% 0px -55% 0px", threshold: [0, 0.2, 1] } ); Object.values(map).forEach((el) => el && io.observe(el)); return () => io.disconnect(); }, [sections]); const handleNav = (id: string) => { const el = refs.current[id]; if (el) el.scrollIntoView({ behavior: "smooth", block: "start" }); }; return (
{/* Active section indicator (optional) */}
{active.toUpperCase()}
); } function GradientBand() { return
; }