1- import React , { FC , useEffect , useRef } from 'react'
1+ import React , { FC , useEffect , useRef , useState } from 'react'
22import Link from 'next/link'
33import { WeekDayProps , mainDays } from './data'
4- import { cn } from 'ui'
4+ import {
5+ Button ,
6+ cn ,
7+ DropdownMenu ,
8+ DropdownMenuContent ,
9+ DropdownMenuItem ,
10+ DropdownMenuTrigger ,
11+ } from 'ui'
512import { isBrowser } from 'common'
613
714import SectionContainer from '~/components/Layouts/SectionContainer'
8- import { ArrowUpRight } from 'lucide-react'
15+ import { ArrowUpRight , ChevronDown } from 'lucide-react'
16+ import { startCase } from 'lodash'
917
1018const LWXStickyNav : FC = ( ) => {
1119 const days = mainDays ( )
20+ const [ activeNavItem , setActiveNavItem ] = useState ( 'Mon' )
1221
1322 const OFFSET = 66
1423 const anchors = useRef < NodeListOf < HTMLHeadingElement > | null > ( null )
@@ -22,6 +31,14 @@ const LWXStickyNav: FC = () => {
2231
2332 if ( offsetFromTop - OFFSET < 0 ) {
2433 newActiveAnchor = anchor . id
34+
35+ // Set the active nav item based on the anchor ID
36+ const matchingDay = days . find ( ( day ) => day . id === newActiveAnchor )
37+ if ( matchingDay ) {
38+ setActiveNavItem ( matchingDay . dd )
39+ } else if ( newActiveAnchor === 'build-stage' ) {
40+ setActiveNavItem ( 'Build Stage' )
41+ }
2542 }
2643 } )
2744
@@ -56,13 +73,50 @@ const LWXStickyNav: FC = () => {
5673 < nav className = "sticky z-30 top-0 bg-default/30 dark:bg-default/90 backdrop-blur-md w-full border-b dark:border-muted h-[60px] flex items-center" >
5774 < SectionContainer className = "!max-w-none !py-0 lg:!container flex items-center justify-between font-mono gap-4 md:gap-8 text-sm" >
5875 < div className = "w-full flex items-center gap-4 md:gap-8" >
76+ < DropdownMenu >
77+ < DropdownMenuTrigger asChild >
78+ < Button
79+ type = "outline"
80+ iconRight = { < ChevronDown /> }
81+ className = "md:hidden w-[200px] min-w-[150px] flex justify-between items-center py-2 pointer-events-auto"
82+ >
83+ < span className = "flex gap-1 items-center" >
84+ { activeNavItem }
85+ { activeNavItem === 'Fri' && (
86+ < span
87+ title = "Live"
88+ className = "w-1 h-1 ml-1 animate-pulse rounded-full bg-brand mb-2 block"
89+ />
90+ ) }
91+ </ span >
92+ </ Button >
93+ </ DropdownMenuTrigger >
94+ < DropdownMenuContent side = "bottom" align = "start" className = "pointer-events-auto" >
95+ { days . map ( ( day ) => (
96+ < DropdownMenuItem key = { day . id } asChild >
97+ < Link href = { `#${ day . id } ` } className = "flex items-center gap-2" >
98+ { day . dd }
99+ { day . isToday && (
100+ < span
101+ title = "Live"
102+ className = "w-1 h-1 animate-pulse rounded-full bg-brand block"
103+ />
104+ ) }
105+ </ Link >
106+ </ DropdownMenuItem >
107+ ) ) }
108+ < DropdownMenuItem asChild >
109+ < Link href = "#build-stage" > Build Stage</ Link >
110+ </ DropdownMenuItem >
111+ </ DropdownMenuContent >
112+ </ DropdownMenu >
59113 < ul className = "w-full lw-sticky-nav flex items-center gap-2 md:gap-4 text-foreground-lighter" >
60114 { days . map ( ( day : WeekDayProps ) => (
61115 < li key = { day . id } >
62116 < Link
63117 href = { `#${ day . id } ` }
64118 className = { cn (
65- 'p-1 transition-colors text-foreground-muted hover:text-foreground flex items-center pointer-events-auto' ,
119+ 'hidden p-1 transition-colors text-foreground-muted hover:text-foreground md: flex items-center pointer-events-auto' ,
66120 ( day . isToday || day . shipped ) && 'text-foreground-light'
67121 ) }
68122 >
@@ -79,12 +133,24 @@ const LWXStickyNav: FC = () => {
79133 < li >
80134 < Link
81135 href = "#build-stage"
82- className = "p-1 transition-colors hover:text-foreground pointer-events-auto lw-sticky-nav"
136+ className = "hidden md:block p-1 transition-colors hover:text-foreground pointer-events-auto lw-sticky-nav"
83137 >
84138 Build < span className = "hidden sm:inline" > Stage</ span >
85139 </ Link >
86140 </ li >
87141 < div className = "flex items-center justify-end gap-2 md:gap-4 flex-1" >
142+ < li >
143+ < Link
144+ href = "/events/launch-week-13-hackathon"
145+ target = "_blank"
146+ className = "p-1 transition-colors hover:text-foreground pointer-events-auto flex gap-1"
147+ >
148+ Hackathon{ ' ' }
149+ < span >
150+ < ArrowUpRight className = "w-4 h-5 text-foreground-muted" />
151+ </ span >
152+ </ Link >
153+ </ li >
88154 < li >
89155 < Link
90156 href = "/events?category=meetup"
0 commit comments