Skip to content

Commit e3fb685

Browse files
darnjodarnjoclaude
authored
Add responsive hamburger menu for mobile navigation (#177)
On screens narrower than 768px, nav links collapse behind a hamburger icon. Tapping it reveals a full-width dropdown with all nav items and the search button. Co-authored-by: darnjo <josh@reso.org> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 43c4614 commit e3fb685

1 file changed

Lines changed: 44 additions & 1 deletion

File tree

.github/pages/_layouts/default.html

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,39 @@
7272
}
7373
.header-nav a:hover { opacity: 1; color: var(--reso-orange); }
7474

75+
/* Hamburger menu button */
76+
.menu-toggle {
77+
display: none;
78+
background: none;
79+
border: none;
80+
cursor: pointer;
81+
padding: 0.5rem;
82+
color: white;
83+
}
84+
.menu-toggle svg { width: 24px; height: 24px; fill: currentColor; }
85+
86+
@media (max-width: 768px) {
87+
.site-header { flex-wrap: wrap; height: auto; min-height: 64px; }
88+
.menu-toggle { display: block; }
89+
.header-nav {
90+
display: none;
91+
flex-direction: column;
92+
width: 100%;
93+
gap: 0;
94+
padding: 0.5rem 0 1rem;
95+
border-top: 1px solid rgba(255,255,255,0.15);
96+
}
97+
.header-nav.open { display: flex; }
98+
.header-nav a {
99+
padding: 0.625rem 0;
100+
opacity: 1;
101+
border-bottom: 1px solid rgba(255,255,255,0.08);
102+
}
103+
.header-nav a:last-of-type { border-bottom: none; }
104+
.search-trigger { margin-top: 0.5rem; justify-content: center; }
105+
.search-trigger kbd { display: none; }
106+
}
107+
75108
/* Main */
76109
.site-main {
77110
flex: 1;
@@ -488,7 +521,10 @@
488521
<a href="{{ '/' | relative_url }}" class="header-logo">
489522
<img src="{{ '/assets/reso-logo-white.png' | relative_url }}" alt="RESO" />
490523
</a>
491-
<nav class="header-nav">
524+
<button class="menu-toggle" id="menuToggle" type="button" aria-label="Toggle menu">
525+
<svg viewBox="0 0 24 24"><path d="M3 6h18M3 12h18M3 18h18" stroke="currentColor" stroke-width="2" stroke-linecap="round" fill="none"/></svg>
526+
</button>
527+
<nav class="header-nav" id="headerNav">
492528
<a href="{{ '/' | relative_url }}">Home</a>
493529
<a href="https://github.com/RESOStandards/transport">GitHub</a>
494530
<a href="https://github.com/RESOStandards/transport/discussions">Discussions</a>
@@ -525,6 +561,13 @@
525561
resetStyles: false
526562
});
527563

564+
// Hamburger menu toggle
565+
var menuToggle = document.getElementById('menuToggle');
566+
var headerNav = document.getElementById('headerNav');
567+
menuToggle.addEventListener('click', function() {
568+
headerNav.classList.toggle('open');
569+
});
570+
528571
var overlay = document.getElementById('searchOverlay');
529572
var trigger = document.getElementById('searchTrigger');
530573

0 commit comments

Comments
 (0)