Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
feat: add mobile menu to docs site
Maximilian Roos08701c171277
diff --git a/docs/sass/custom.scss b/docs/sass/custom.scssindex 567ded165..42ccba50c 100644--- a/docs/sass/custom.scss+++ b/docs/sass/custom.scss@@ -90,7 +90,10 @@ header {box-shadow: none !important;position: sticky;top: 0;- z-index: 100;+ // Z-index hierarchy: overlay(199) < menu(200) < header(201)+ // Header must be above menu so the toggle button in the header remains clickable+ // when the menu is open (menu slides out from under the header)+ z-index: 201;}.logo {@@ -750,9 +753,152 @@ ul > li::marker {}}+// ============================================================================+// Mobile Menu+// Z-index: overlay(199) < menu(200) < header(201)+// ============================================================================++.mobile-menu-toggle {+ display: none; // Hidden by default, shown at 768px breakpoint+ align-items: center;+ justify-content: center;+ background: none;+ border: none;+ padding: 0.5rem;+ margin-left: auto;+ cursor: pointer;+ color: var(--wt-color-text);+ transition: color 150ms;+ -webkit-tap-highlight-color: transparent;++ &:hover {+ color: var(--wt-color-accent);+ }++ .close-icon {+ display: none;+ }++ &[aria-expanded="true"] {+ .menu-icon {+ display: none;+ }+ .close-icon {+ display: block;+ }+ }+}++.mobile-menu-overlay {+ display: none;+ position: fixed;+ inset: 0;+ background: rgba(0, 0, 0, 0.4);+ z-index: 199;+ opacity: 0;+ transition: opacity 200ms ease;++ &.active {+ display: block;+ opacity: 1;+ }+}++.mobile-menu {+ display: none;+ position: fixed;+ // --wt-header-height updates to 50px in @media (max-width: 768px)+ top: var(--wt-header-height);+ left: 0;+ width: min(260px, 70vw);+ height: calc(100dvh - var(--wt-header-height));+ background: var(--wt-color-bg-elevated);+ border-right: 1px solid var(--wt-color-border-subtle);+ z-index: 200;+ transform: translateX(-100%);+ transition: transform 250ms ease;+ overflow-y: auto;+ overscroll-behavior: contain;++ &.active {+ display: block;+ transform: translateX(0);+ }+}++.mobile-menu-content {+ padding: 1rem 0.75rem 2rem;+}++.mobile-menu-section {+ display: flex;+ flex-direction: column;+ gap: 0.25rem;+}++.mobile-nav-item {+ display: block;+ padding: 0.6rem 0.75rem;+ font-size: 0.95rem;+ font-weight: 500;+ color: var(--wt-color-text);+ border-radius: 0.375rem;+ transition: background 150ms, color 150ms;++ &:hover {+ background: var(--wt-color-bg-soft);+ text-decoration: none;+ }+}++.mobile-menu-divider {+ height: 1px;+ background: var(--wt-color-border-subtle);+ margin: 1rem 0;+}++.mobile-menu-toc {+ gap: 0;+}++.mobile-toc-group {+ font-size: 0.65rem;+ font-weight: 600;+ text-transform: uppercase;+ letter-spacing: 0.05em;+ color: var(--wt-color-text-soft);+ padding: 0.6rem 0.75rem 0.2rem;+ margin-top: 0.4rem;++ &:first-child {+ margin-top: 0;+ }+}++.mobile-toc-item {+ display: block;+ padding: 0.5rem 0.75rem;+ font-size: 0.85rem;+ color: var(--wt-color-text-muted);+ border-radius: 0.25rem;+ transition: background 150ms, color 150ms;++ &:hover {+ background: var(--wt-color-bg-soft);+ color: var(--wt-color-text);+ text-decoration: none;+ }+}++// Prevent body scroll when mobile menu is open+body.mobile-menu-open {+ overflow: hidden;+}+@media screen and (max-width: 768px) {:root {- --wt-header-height: 50px; // Approximate for auto height+ // Mobile header is fixed height (logo + toggle only, nav hidden)+ --wt-header-height: 50px;--wt-main-padding-top: 20px;}@@ -762,11 +908,16 @@ ul > li::marker {header {padding: 10px 20px;- height: auto;+ height: var(--wt-header-height);+ display: flex;+ flex-direction: row;+ align-items: center;+ justify-content: space-between;}- .search-container {- display: none; // Hide search on mobile for now+ // Hide desktop nav on mobile - use hamburger menu instead+ header nav {+ display: none;}main {@@ -801,6 +952,11 @@ ul > li::marker {.toc {display: none;}++ // Show mobile menu toggle on mobile+ .mobile-menu-toggle {+ display: flex;+ }}// ============================================================================@@ -1017,7 +1173,7 @@ body::before {height: 100%;pointer-events: none;opacity: 0.015;- z-index: 9999;+ z-index: 50; // Below all interactive UIbackground-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");}diff --git a/docs/static/mobile-menu.js b/docs/static/mobile-menu.jsnew file mode 100644index 000000000..c16d91769--- /dev/null+++ b/docs/static/mobile-menu.js@@ -0,0 +1,72 @@+// Mobile menu toggle functionality+(function() {+ const toggle = document.querySelector('.mobile-menu-toggle');+ const menu = document.querySelector('.mobile-menu');+ const overlay = document.querySelector('.mobile-menu-overlay');++ if (!toggle || !menu || !overlay) return;++ function openMenu() {+ toggle.setAttribute('aria-expanded', 'true');+ toggle.setAttribute('aria-label', 'Close menu');+ menu.classList.add('active');+ menu.setAttribute('aria-hidden', 'false');+ overlay.classList.add('active');+ overlay.setAttribute('aria-hidden', 'false');+ document.body.classList.add('mobile-menu-open');+ // Move focus to first menu link+ var firstLink = menu.querySelector('a');+ if (firstLink) firstLink.focus();+ }++ function closeMenu() {+ toggle.setAttribute('aria-expanded', 'false');+ toggle.setAttribute('aria-label', 'Open menu');+ menu.classList.remove('active');+ menu.setAttribute('aria-hidden', 'true');+ overlay.classList.remove('active');+ overlay.setAttribute('aria-hidden', 'true');+ document.body.classList.remove('mobile-menu-open');+ }++ function toggleMenu() {+ var isOpen = toggle.getAttribute('aria-expanded') === 'true';+ if (isOpen) {+ closeMenu();+ } else {+ openMenu();+ }+ }++ // Toggle button click+ toggle.addEventListener('click', toggleMenu);++ // Close on overlay click+ overlay.addEventListener('click', closeMenu);++ // Close on escape key+ document.addEventListener('keydown', function(e) {+ if (e.key === 'Escape' && toggle.getAttribute('aria-expanded') === 'true') {+ closeMenu();+ toggle.focus();+ }+ });++ // Close menu when clicking a link (using event delegation)+ menu.addEventListener('click', function(e) {+ if (e.target.tagName === 'A') {+ closeMenu();+ }+ });++ // Close menu on window resize if viewport becomes larger+ var resizeTimer;+ window.addEventListener('resize', function() {+ clearTimeout(resizeTimer);+ resizeTimer = setTimeout(function() {+ if (window.innerWidth > 768 && toggle.getAttribute('aria-expanded') === 'true') {+ closeMenu();+ }+ }, 100);+ });+})();diff --git a/docs/templates/base.html b/docs/templates/base.htmlindex bc2faf4a8..c849395bb 100644--- a/docs/templates/base.html+++ b/docs/templates/base.html@@ -74,6 +74,7 @@<script src="/search_index.en.js" defer></script><script src="/search.js" defer></script><script src="/code-copy.js" defer></script>+<script src="/mobile-menu.js" defer></script><script src="//instant.page/5.2.0" type="module" integrity="sha384-jnZyxPjiipYXnSU0ygqeac2q7CVYMbh84q0uHVRRxEtvFPiQYbXWUorga2aqZJ0z"></script>{% endblock head %}@@ -94,7 +95,43 @@<a class="nav-item subtitle-text" href="{{ menu.link | safe }}">{{ menu.title }}</a>{% endfor %}</nav>+ <button class="mobile-menu-toggle" aria-label="Open menu" aria-expanded="false">+ <svg class="menu-icon" aria-hidden="true" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">+ <line x1="3" y1="6" x2="21" y2="6"></line>+ <line x1="3" y1="12" x2="21" y2="12"></line>+ <line x1="3" y1="18" x2="21" y2="18"></line>+ </svg>+ <svg class="close-icon" aria-hidden="true" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">+ <line x1="18" y1="6" x2="6" y2="18"></line>+ <line x1="6" y1="6" x2="18" y2="18"></line>+ </svg>+ </button></header>++<!-- Mobile menu drawer -->+<div class="mobile-menu-overlay" aria-hidden="true"></div>+<nav class="mobile-menu" aria-hidden="true">+ <div class="mobile-menu-content">+ <div class="mobile-menu-section">+ {% for menu in config.extra.juice_extra_menu %}+ <a class="mobile-nav-item" href="{{ menu.link | safe }}">{{ menu.title }}</a>+ {% endfor %}+ </div>+ <div class="mobile-menu-divider"></div>+ <div class="mobile-menu-section mobile-menu-toc">+ {% set docs_section = get_section(path="_index.md") %}+ {% set current_group = "" %}+ {% for doc_page in docs_section.pages %}+ {% set page_group = doc_page.extra.group | default(value="") %}+ {% if page_group != current_group and page_group != "" %}+ <div class="mobile-toc-group">{{ page_group }}</div>+ {% set_global current_group = page_group %}+ {% endif %}+ <a class="mobile-toc-item" href="{{ doc_page.permalink | safe }}">{{ doc_page.title }}</a>+ {% endfor %}+ </div>+ </div>+</nav><div class="hero">{% block hero %}{% endblock hero %}</div>