Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions site/src/components/DocsSidebar.astro
Original file line number Diff line number Diff line change
Expand Up @@ -187,17 +187,20 @@ function initSidebar() {
const overlay = document.getElementById('sidebar-overlay');
if (!mobileSidebar || !overlay) return;

const newOverlay = overlay.cloneNode(true);
overlay.parentNode?.replaceChild(newOverlay, overlay);

function closeSidebar() {
mobileSidebar.classList.add('-translate-x-full');
mobileSidebar.setAttribute('aria-hidden', 'true');
mobileSidebar.inert = true;
overlay.classList.add('hidden');
overlay.setAttribute('aria-hidden', 'true');
newOverlay.classList.add('hidden');
newOverlay.setAttribute('aria-hidden', 'true');
var menuBtn = document.getElementById('bottom-nav-docs-btn');
if (menuBtn) menuBtn.setAttribute('aria-expanded', 'false');
}

overlay.onclick = closeSidebar;
newOverlay.addEventListener('click', closeSidebar);
mobileSidebar.querySelectorAll('a').forEach((a) => {
a.onclick = closeSidebar;
});
Expand Down
22 changes: 13 additions & 9 deletions site/src/components/Nav.astro
Original file line number Diff line number Diff line change
Expand Up @@ -78,27 +78,31 @@ const isDocs = Astro.url.pathname === '/docs' || Astro.url.pathname.startsWith('
function initNav() {
const btn = document.getElementById('bottom-nav-docs-btn');
const docsSidebar = document.getElementById('docs-sidebar-mobile');
const overlay = document.getElementById('sidebar-overlay');
if (!btn || !docsSidebar || !overlay) return;
if (!btn || !docsSidebar) return;

btn.setAttribute('aria-expanded', 'false');
// Remove old listeners by cloning
const newBtn = btn.cloneNode(true);
btn.parentNode?.replaceChild(newBtn, btn);

btn.onclick = () => {
newBtn.setAttribute('aria-expanded', 'false');

newBtn.addEventListener('click', () => {
const liveOverlay = document.getElementById('sidebar-overlay');
const isOpen = !docsSidebar.classList.contains('-translate-x-full');
if (isOpen) {
docsSidebar.classList.add('-translate-x-full');
docsSidebar.setAttribute('aria-hidden', 'true');
docsSidebar.inert = true;
if (overlay) { overlay.classList.add('hidden'); overlay.setAttribute('aria-hidden', 'true'); }
btn.setAttribute('aria-expanded', 'false');
if (liveOverlay) { liveOverlay.classList.add('hidden'); liveOverlay.setAttribute('aria-hidden', 'true'); }
newBtn.setAttribute('aria-expanded', 'false');
} else {
docsSidebar.classList.remove('-translate-x-full');
docsSidebar.setAttribute('aria-hidden', 'false');
docsSidebar.inert = false;
if (overlay) { overlay.classList.remove('hidden'); overlay.setAttribute('aria-hidden', 'false'); }
btn.setAttribute('aria-expanded', 'true');
if (liveOverlay) { liveOverlay.classList.remove('hidden'); liveOverlay.setAttribute('aria-hidden', 'false'); }
newBtn.setAttribute('aria-expanded', 'true');
}
};
});
}
// Defer init until sidebar DOM exists (Nav renders before DocsSidebar).
// Bail after a few frames if sidebar never appears (non-docs pages).
Expand Down
4 changes: 2 additions & 2 deletions site/src/layouts/Docs.astro
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ const { prev, next } = getPrevNext(currentPath);

<Base title={`${title} - Mantle Docs`}>
<Nav />
<div class="mx-auto max-w-[1280px] px-4 sm:px-6">
<div class="flex min-h-screen pt-16 pb-20 lg:pb-0">
<div class="mx-auto max-w-[1280px] px-4 sm:px-6 overflow-x-hidden">
<div class="flex min-h-screen pt-16 pb-16 lg:pb-0">
<DocsSidebar currentPath={currentPath} />

<!-- Main content -->
Expand Down
2 changes: 1 addition & 1 deletion site/src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Footer from '../components/Footer.astro';
<Base title="Mantle — Headless AI Workflow Automation">
<div data-pagefind-ignore>
<Nav isHome={true} />
<main id="main-content" class="pb-20 lg:pb-0">
<main id="main-content" class="pb-16 lg:pb-0">
<Hero />
<Features />
<HowItWorks />
Expand Down
3 changes: 1 addition & 2 deletions site/src/styles/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,7 @@ body {
}

.prose code {
overflow-wrap: anywhere;
word-break: normal;
overflow-wrap: break-word;
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
}

Expand Down
Loading