Skip to content

Commit

Permalink
fix: hide mobile menu when sidebar disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
jer3m01 committed Nov 15, 2024
1 parent 06f1eea commit 37a1b18
Showing 1 changed file with 30 additions and 18 deletions.
48 changes: 30 additions & 18 deletions src/default-theme/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,25 +70,37 @@ export default function Header() {
<ThemeSelector />
</div>
</div>
<div class={styles["mobile-bar"]}>
<button
type="button"
class={styles["mobile-menu"]}
onClick={() => setSidebarOpen((p) => !p)}
aria-label="Open navigation"
>
<MenuLeftIcon /> Menu
</button>
<Show when={pageData().layout.toc !== false}>
<Dialog.Trigger
type="button"
class={styles["mobile-menu"]}
aria-label="Open table of contents"
<Show
when={
pageData().layout?.sidebar !== false ||
pageData().layout?.toc !== false
}
>
<div class={styles["mobile-bar"]}>
<Show
when={pageData().layout?.sidebar !== false}
fallback={<div />}
>
On this page <ArrowDownIcon />
</Dialog.Trigger>
</Show>
</div>
<button
type="button"
class={styles["mobile-menu"]}
onClick={() => setSidebarOpen((p) => !p)}
aria-label="Open navigation"
>
<MenuLeftIcon /> Menu
</button>
</Show>
<Show when={pageData().layout?.toc !== false}>
<Dialog.Trigger
type="button"
class={styles["mobile-menu"]}
aria-label="Open table of contents"
>
On this page <ArrowDownIcon />
</Dialog.Trigger>
</Show>
</div>
</Show>

<div ref={setTocRef} class={styles["toc-container"]} />
</header>
Expand Down

0 comments on commit 37a1b18

Please sign in to comment.