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)), 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 { function closeMenus(): void {
navOpen = false; navOpen = false;
profileOpen = false; profileOpen = false;
@@ -164,6 +167,7 @@
<span>{brand}</span> <span>{brand}</span>
</a> </a>
{#if hasNavItems}
<nav aria-label="Primary navigation" class="sc-nav" data-open={navOpen}> <nav aria-label="Primary navigation" class="sc-nav" data-open={navOpen}>
{#each navItems as item} {#each navItems as item}
{@const Icon = iconFor(item)} {@const Icon = iconFor(item)}
@@ -185,6 +189,7 @@
</a> </a>
{/each} {/each}
</nav> </nav>
{/if}
<div class="sc-header-actions"> <div class="sc-header-actions">
{#if actions}{@render actions()}{/if} {#if actions}{@render actions()}{/if}
@@ -273,6 +278,7 @@
</div> </div>
{/if} {/if}
{#if hasNavItems}
<button <button
aria-expanded={navOpen} aria-expanded={navOpen}
aria-label={navOpen ? 'Close navigation menu' : 'Open navigation menu'} aria-label={navOpen ? 'Close navigation menu' : 'Open navigation menu'}
@@ -282,5 +288,6 @@
> >
{navOpen ? '×' : '☰'} {navOpen ? '×' : '☰'}
</button> </button>
{/if}
</div> </div>
</header> </header>