fix(web): keep mobile navigation readable
This commit is contained in:
@@ -68,7 +68,13 @@ export function AppLayout({
|
||||
|
||||
useEffect(() => {
|
||||
const media = window.matchMedia(MOBILE_SHELL_MEDIA)
|
||||
const updateMobileShell = () => setMobileShell(media.matches)
|
||||
const updateMobileShell = () => {
|
||||
const isMobile = media.matches
|
||||
setMobileShell(isMobile)
|
||||
if (isMobile) {
|
||||
setCollapsed(false)
|
||||
}
|
||||
}
|
||||
|
||||
updateMobileShell()
|
||||
media.addEventListener('change', updateMobileShell)
|
||||
@@ -102,7 +108,10 @@ export function AppLayout({
|
||||
// Keep the navigation shell in the server-rendered HTML. If a rolling deploy
|
||||
// or stale browser cache delays hydration, the operator still has navigation.
|
||||
const effectiveCollapsed = mounted ? collapsed : false
|
||||
const shellCollapsed = mobileShell || effectiveCollapsed
|
||||
const shellCollapsed = effectiveCollapsed
|
||||
const contentOffsetClass = shellCollapsed
|
||||
? mobileShell ? 'ml-[48px]' : 'ml-[64px]'
|
||||
: 'ml-[224px]'
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-nothing-gray-50">
|
||||
@@ -137,7 +146,7 @@ export function AppLayout({
|
||||
'relative z-10',
|
||||
'pt-[68px]',
|
||||
'transition-all duration-300 ease-out',
|
||||
mobileShell ? 'ml-[48px]' : shellCollapsed ? 'ml-[64px]' : 'ml-[224px]'
|
||||
contentOffsetClass
|
||||
)}
|
||||
>
|
||||
{fullBleed ? (
|
||||
|
||||
@@ -51,7 +51,7 @@ export function Header({
|
||||
window.location.href = newPath
|
||||
}, [locale, pathname])
|
||||
|
||||
const brandWidth = compact ? 64 : sidebarCollapsed ? 64 : 224
|
||||
const brandWidth = sidebarCollapsed ? 64 : 224
|
||||
|
||||
return (
|
||||
<header
|
||||
|
||||
Reference in New Issue
Block a user