diff --git a/frontend/src/Navigation.tsx b/frontend/src/Navigation.tsx index 4709f4ae..a2cedb03 100644 --- a/frontend/src/Navigation.tsx +++ b/frontend/src/Navigation.tsx @@ -1,4 +1,4 @@ -import { useRef, useState } from 'react'; +import { useEffect, useRef, useState } from 'react'; import { NavLink } from 'react-router-dom'; import Arrow1 from './assets/arrow.svg'; import Arrow2 from './assets/dropdown-arrow.svg'; @@ -58,6 +58,19 @@ export default function Navigation({ [navState, isDocsListOpen, apiKeyModalState], ); + /* + Needed to fix bug where if mobile nav was closed and then window was resized to desktop, nav would still be closed but the button to open would be gone, as per #1 on issue #146 + */ + useEffect(() => { + window.addEventListener('resize', () => { + if (window.matchMedia('(min-width: 768px)').matches) { + setNavState('ACTIVE'); + } else { + setNavState('INACTIVE'); + } + }); + }, []); + return ( <>
-
+