@@ -167,7 +167,6 @@ export default function TopNav({
167167 const asPath = usePathname ( ) || '/' ;
168168 const [ openMenuPath , setOpenMenuPath ] = useState < string | null > ( null ) ;
169169 const [ showSearch , setShowSearch ] = useState ( false ) ;
170- const [ isScrolled , setIsScrolled ] = useState ( false ) ;
171170 const scrollParentRef = useRef < HTMLDivElement > ( null ) ;
172171 // Deriving from the path hides the menu as soon as a navigation commits.
173172 // Forget the path afterwards, so going Back doesn't reopen the menu.
@@ -211,24 +210,6 @@ export default function TopNav({
211210 } ;
212211 } , [ ] ) ;
213212
214- const scrollDetectorRef = useRef ( null ) ;
215- useEffect ( ( ) => {
216- const observer = new IntersectionObserver (
217- ( entries ) => {
218- entries . forEach ( ( entry ) => {
219- setIsScrolled ( ! entry . isIntersecting ) ;
220- } ) ;
221- } ,
222- {
223- root : null ,
224- rootMargin : `0px 0px` ,
225- threshold : 0 ,
226- }
227- ) ;
228- observer . observe ( scrollDetectorRef . current ! ) ;
229- return ( ) => observer . disconnect ( ) ;
230- } , [ ] ) ;
231-
232213 const onOpenSearch = useCallback ( ( ) => {
233214 startTransition ( ( ) => {
234215 setShowSearch ( true ) ;
@@ -245,7 +226,6 @@ export default function TopNav({
245226 onOpen = { onOpenSearch }
246227 onClose = { onCloseSearch }
247228 />
248- < div ref = { scrollDetectorRef } />
249229 < div
250230 className = { cn (
251231 isMenuOpen
@@ -254,8 +234,8 @@ export default function TopNav({
254234 ) } >
255235 < nav
256236 className = { cn (
257- 'duration-300 backdrop-filter backdrop-blur-lg backdrop-saturate-200 transition-shadow bg-opacity-90 items-center w-full flex justify-between bg-wash dark:bg-wash-dark dark:bg-opacity-95 px-1.5 lg:pe-5 lg:ps-4 z-40' ,
258- { 'dark:shadow-nav-dark shadow-nav' : isScrolled || isMenuOpen }
237+ 'items-center w-full flex justify-between bg-wash dark:bg-wash-dark px-1.5 lg:pe-5 lg:ps-4 z-40' ,
238+ isMenuOpen && 'dark:shadow-nav-dark shadow-nav'
259239 ) } >
260240 < div className = "flex items-center justify-between w-full h-16 gap-0 sm:gap-3" >
261241 < div className = "flex flex-row 3xl:flex-1 items-centers" >
0 commit comments