Skip to content

Commit 8100636

Browse files
michaelmcneesclaude
andcommitted
feat: replace mobile top nav with bottom navigation bar for better reachability
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d012699 commit 8100636

4 files changed

Lines changed: 44 additions & 33 deletions

File tree

site/src/components/DocsSidebar.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ function isParentActive(item: NavItem): boolean {
9393
<div id="sidebar-overlay" class="fixed inset-0 z-40 bg-black/50 hidden lg:hidden" aria-hidden="true"></div>
9494

9595
<!-- Mobile sidebar drawer -->
96-
<aside id="docs-sidebar-mobile" class="fixed top-16 left-0 bottom-0 z-50 w-72 bg-surface-container-lowest border-r border-outline-variant transform -translate-x-full transition-transform duration-200 lg:hidden overflow-y-auto">
96+
<aside id="docs-sidebar-mobile" class="fixed top-16 left-0 bottom-14 md:bottom-0 z-50 w-72 bg-surface-container-lowest border-r border-outline-variant transform -translate-x-full transition-transform duration-200 lg:hidden overflow-y-auto">
9797
<nav class="py-6 px-4" aria-label="Documentation sidebar mobile">
9898
{docsNav.map((group) => (
9999
<div class="mb-8">

site/src/components/Nav.astro

Lines changed: 41 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -31,57 +31,68 @@ const isDocs = !isHome;
3131
</a>
3232
</div>
3333

34-
<!-- Mobile hamburger -->
35-
<button id="mobile-menu-btn" class="md:hidden text-on-surface-variant hover:text-on-surface" aria-label="Menu">
36-
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"/></svg>
37-
</button>
3834
</div>
35+
</nav>
3936

40-
<!-- Mobile menu -->
41-
<div id="mobile-menu" class="hidden md:hidden border-t border-outline-variant bg-surface/95 backdrop-blur-md">
42-
<div class="px-6 py-4 flex flex-col gap-3">
43-
<a href={`${prefix}#how-it-works`} class="text-sm text-on-surface-variant hover:text-on-surface transition-colors">How It Works</a>
44-
<a href={`${prefix}#connectors`} class="text-sm text-on-surface-variant hover:text-on-surface transition-colors">Connectors</a>
45-
<a href={`${prefix}#comparison`} class="text-sm text-on-surface-variant hover:text-on-surface transition-colors">Compare</a>
46-
<a href="/docs/getting-started" class:list={["text-sm transition-colors", isDocs ? "text-primary font-medium" : "text-on-surface-variant hover:text-on-surface"]}>Docs</a>
47-
<a href={`${prefix}#get-started`} class="inline-flex justify-center px-4 py-2 bg-primary text-on-primary text-sm font-medium mt-2">Get Started</a>
48-
</div>
37+
<!-- Mobile bottom navigation bar -->
38+
<nav id="mobile-bottom-nav" class="fixed bottom-0 left-0 right-0 z-50 md:hidden border-t border-outline-variant bg-surface/95 backdrop-blur-md">
39+
<div class="flex items-center justify-around h-14 px-2">
40+
<a href="/" class:list={["bottom-nav-item flex flex-col items-center gap-0.5 px-3 py-1 text-[11px] transition-colors", isHome ? "text-primary" : "text-on-surface-variant hover:text-on-surface"]}>
41+
<svg class="w-5 h-5" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M2.25 12l8.954-8.955a1.126 1.126 0 011.591 0L21.75 12M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25"/></svg>
42+
<span>Home</span>
43+
</a>
44+
{isDocs && (
45+
<button id="bottom-nav-docs-btn" class="bottom-nav-item flex flex-col items-center gap-0.5 px-3 py-1 text-[11px] text-on-surface-variant hover:text-on-surface transition-colors" aria-label="Documentation menu">
46+
<svg class="w-5 h-5" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5"/></svg>
47+
<span>Menu</span>
48+
</button>
49+
)}
50+
<a href="/docs/getting-started" class:list={["bottom-nav-item flex flex-col items-center gap-0.5 px-3 py-1 text-[11px] transition-colors", isDocs ? "text-primary" : "text-on-surface-variant hover:text-on-surface"]}>
51+
<svg class="w-5 h-5" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M12 6.042A8.967 8.967 0 006 3.75c-1.052 0-2.062.18-3 .512v14.25A8.987 8.987 0 016 18c2.305 0 4.408.867 6 2.292m0-14.25a8.966 8.966 0 016-2.292c1.052 0 2.062.18 3 .512v14.25A8.987 8.987 0 0018 18a8.967 8.967 0 00-6 2.292m0-14.25v14.25"/></svg>
52+
<span>Docs</span>
53+
</a>
54+
<a href="https://github.com/dvflw/mantle" class="bottom-nav-item flex flex-col items-center gap-0.5 px-3 py-1 text-[11px] text-on-surface-variant hover:text-on-surface transition-colors" aria-label="GitHub">
55+
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 24 24"><path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z"/></svg>
56+
<span>GitHub</span>
57+
</a>
4958
</div>
5059
</nav>
5160

5261
<style>
5362
.nav-inner {
5463
transition: max-width 0.3s ease;
5564
}
65+
#mobile-bottom-nav {
66+
padding-bottom: env(safe-area-inset-bottom, 0px);
67+
}
68+
.bottom-nav-item {
69+
-webkit-tap-highlight-color: transparent;
70+
min-width: 3.5rem;
71+
}
72+
.bottom-nav-item:active {
73+
opacity: 0.7;
74+
}
5675
</style>
5776

5877
<script is:inline>
5978
function initNav() {
60-
const btn = document.getElementById('mobile-menu-btn');
61-
const menu = document.getElementById('mobile-menu');
79+
const btn = document.getElementById('bottom-nav-docs-btn');
6280
const docsSidebar = document.getElementById('docs-sidebar-mobile');
6381
const overlay = document.getElementById('sidebar-overlay');
64-
if (!btn) return;
82+
if (!btn || !docsSidebar || !overlay) return;
6583

6684
// Remove old listeners by cloning
6785
const newBtn = btn.cloneNode(true);
6886
btn.parentNode?.replaceChild(newBtn, btn);
6987

7088
newBtn.addEventListener('click', () => {
71-
if (docsSidebar && overlay) {
72-
// On docs pages, toggle the sidebar drawer instead of the dropdown
73-
const isOpen = !docsSidebar.classList.contains('-translate-x-full');
74-
if (isOpen) {
75-
docsSidebar.classList.add('-translate-x-full');
76-
overlay.classList.add('hidden');
77-
} else {
78-
docsSidebar.classList.remove('-translate-x-full');
79-
overlay.classList.remove('hidden');
80-
}
81-
// Keep dropdown hidden
82-
if (menu) menu.classList.add('hidden');
83-
} else if (menu) {
84-
menu.classList.toggle('hidden');
89+
const isOpen = !docsSidebar.classList.contains('-translate-x-full');
90+
if (isOpen) {
91+
docsSidebar.classList.add('-translate-x-full');
92+
overlay.classList.add('hidden');
93+
} else {
94+
docsSidebar.classList.remove('-translate-x-full');
95+
overlay.classList.remove('hidden');
8596
}
8697
});
8798
}

site/src/layouts/Docs.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const { prev, next } = getPrevNext(currentPath);
2525
<Base title={`${title} - Mantle Docs`}>
2626
<Nav />
2727
<div class="mx-auto max-w-[1280px] px-4 sm:px-6 overflow-x-hidden">
28-
<div class="flex min-h-screen pt-16">
28+
<div class="flex min-h-screen pt-16 pb-16 md:pb-0">
2929
<DocsSidebar currentPath={currentPath} />
3030

3131
<!-- Main content -->

site/src/pages/index.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import Footer from '../components/Footer.astro';
1212
---
1313
<Base title="Mantle — Headless AI Workflow Automation">
1414
<Nav isHome={true} />
15-
<main id="main-content">
15+
<main id="main-content" class="pb-16 md:pb-0">
1616
<Hero />
1717
<Features />
1818
<HowItWorks />

0 commit comments

Comments
 (0)