fix: hide navigation controls for a single nav item
Docker / Docker Build & Push (push) Successful in 3m51s

This commit is contained in:
Gabriel20xx committed 2026-10-26 14:13:18 +00:00
1 parent 4e9cb20971
commit 0d27c9a8d9
1 file changed
+7
@@ -130,6 +130,9 @@
Boolean(username && (onProfile || (showSettings && onSettings) || onAbout || aboutHref || onLogout)),
);
// A lone nav item is just the app's home page, so it isn't worth a header tab (or a menu toggle).
const hasNavItems = $derived(navItems.length > 1);
function closeMenus(): void {
navOpen = false;
profileOpen = false;
@@ -164,6 +167,7 @@
<span>{brand}</span>
</a>
{#if hasNavItems}
<nav aria-label="Primary navigation" class="sc-nav" data-open={navOpen}>
{#each navItems as item}
{@const Icon = iconFor(item)}
@@ -185,6 +189,7 @@
</a>
{/each}
</nav>
{/if}
<div class="sc-header-actions">
{#if actions}{@render actions()}{/if}
@@ -273,6 +278,7 @@
</div>
{/if}
{#if hasNavItems}
<button
aria-expanded={navOpen}
aria-label={navOpen ? 'Close navigation menu' : 'Open navigation menu'}
@@ -282,5 +288,6 @@
>
{navOpen ? '×' : '☰'}
</button>
{/if}
</div>
</header>