Skip to content

Commit 09c1f82

Browse files
committed
fix: show mobile nav menu on splash homepage
Splash pages disable the sidebar, which also hid the mobile menu toggle.
1 parent 324692a commit 09c1f82

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

src/components/PageFrame.astro

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
---
22
import MobileMenuToggle from 'virtual:starlight/components/MobileMenuToggle';
3+
import Sidebar from 'virtual:starlight/components/Sidebar';
34
import SplashBackground from './SplashBackground.astro';
45
import SplashFeatureHotspots from './SplashFeatureHotspots.astro';
56
67
const { hasSidebar, entry } = Astro.locals.starlightRoute;
78
const hasHero = Boolean(entry.data.hero);
9+
const showMobileNav = hasSidebar || hasHero;
810
---
911

1012
<div class="page sl-flex">
1113
{hasHero && <SplashBackground />}
1214
{hasHero && <SplashFeatureHotspots />}
1315
<header class="header"><slot name="header" /></header>
1416
{
15-
hasSidebar && (
17+
showMobileNav && (
1618
<nav class="sidebar print:hidden" aria-label={Astro.locals.t('sidebarNav.accessibleLabel')}>
1719
<MobileMenuToggle />
1820
<div id="starlight__sidebar" class="sidebar-pane">
1921
<div class="sidebar-content sl-flex">
20-
<slot name="sidebar" />
22+
{hasSidebar ? <slot name="sidebar" /> : <Sidebar />}
2123
</div>
2224
</div>
2325
</nav>
@@ -46,7 +48,8 @@ const hasHero = Boolean(entry.data.hero);
4648
background-color: var(--sl-color-bg-nav);
4749
}
4850

49-
:global([data-has-sidebar]) .header {
51+
:global([data-has-sidebar]) .header,
52+
:global([data-has-hero]) .header {
5053
padding-inline-end: calc(
5154
var(--sl-nav-gap) + var(--sl-nav-pad-x) + var(--sl-menu-button-size)
5255
);
@@ -89,7 +92,8 @@ const hasHero = Boolean(entry.data.hero);
8992
}
9093

9194
@media (min-width: 50rem) {
92-
:global([data-has-sidebar]) .header {
95+
:global([data-has-sidebar]) .header,
96+
:global([data-has-hero]) .header {
9397
padding-inline-end: var(--sl-nav-pad-x);
9498
}
9599
.sidebar-pane {
@@ -98,6 +102,12 @@ const hasHero = Boolean(entry.data.hero);
98102
background-color: var(--sl-color-bg-sidebar);
99103
border-inline-end: 1px solid var(--sl-color-hairline-shade);
100104
}
105+
:global([data-has-hero]) .sidebar-pane {
106+
--sl-sidebar-visibility: hidden;
107+
width: 0;
108+
border-inline-end: 0;
109+
overflow: hidden;
110+
}
101111
}
102112
}
103113
</style>

0 commit comments

Comments
 (0)