diff --git a/components/layout/StickyNav.tsx b/components/layout/StickyNav.tsx index c5b8080..354ce7b 100644 --- a/components/layout/StickyNav.tsx +++ b/components/layout/StickyNav.tsx @@ -26,6 +26,8 @@ export function StickyNav() { const ulRef = useRef(null) const linkRefs = useRef<(HTMLAnchorElement | null)[]>([]) const hasAnimated = useRef(false) + const mobilePillRef = useRef(null) + const mobileAccordionRef = useRef(null) useEffect(() => { const onScroll = () => setScrolled(window.scrollY > 60) @@ -55,6 +57,7 @@ export function StickyNav() { return () => observer.disconnect() }, [isHome]) + // Desktop indicator animation useGSAP(() => { const ul = ulRef.current if (!ul) return @@ -89,29 +92,55 @@ export function StickyNav() { } }, { dependencies: [activeSection] }) + // Mobile accordion — set initial state + useGSAP(() => { + gsap.set(mobileAccordionRef.current, { height: 0 }) + gsap.set(mobilePillRef.current, { borderRadius: 24 }) + }, { dependencies: [] }) + + // Mobile accordion — animate on toggle + useGSAP(() => { + const accordion = mobileAccordionRef.current + const pill = mobilePillRef.current + if (!accordion || !pill) return + + if (menuOpen) { + gsap.to(accordion, { + height: 'auto', + duration: 0.35, + ease: 'power3.out', + overwrite: true, + }) + } else { + gsap.to(accordion, { + height: 0, + duration: 0.25, + ease: 'power3.in', + overwrite: true, + }) + } + }, { dependencies: [menuOpen] }) + + const pillBg = scrolled + ? 'bg-black/90 border-white/[0.08]' + : 'bg-white/[0.08] border-white/[0.12]' + return (
{/* Desktop — centered floating dark pill */}
-
-
- {/* Mobile — simple flex row */} - - - {menuOpen && ( - <> - {/* ponytail: backdrop dismiss */} + {/* Mobile — pill with integrated accordion */} +
+ {/* ponytail: backdrop dismiss */} + {menuOpen && (
) }