📱fix: set initial nav visibility for small screens (#3208)

* fix: hide nav on small screens by default

* test: add spec for Nav component
This commit is contained in:
Arthur Barrett 2024-06-27 10:56:32 -04:00 committed by GitHub
parent 81292bb4dd
commit b8f2bee3fc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 136 additions and 0 deletions

View file

@ -42,6 +42,10 @@ const Nav = ({ navVisible, setNavVisible }) => {
useEffect(() => {
if (isSmallScreen) {
const savedNavVisible = localStorage.getItem('navVisible');
if (savedNavVisible === null) {
toggleNavVisible();
}
setNavWidth('320px');
} else {
setNavWidth('260px');
@ -102,6 +106,7 @@ const Nav = ({ navVisible, setNavVisible }) => {
<TooltipProvider delayDuration={250}>
<Tooltip>
<div
data-testid="nav"
className={
'nav active max-w-[320px] flex-shrink-0 overflow-x-hidden bg-gray-50 dark:bg-gray-850 md:max-w-[260px]'
}