Skip to content

Commit cda4820

Browse files
sinelawclaude
andcommitted
Add responsive hamburger menu for mobile navigation
- Replace multi-row nav with hamburger menu on mobile - Nav scrolls away on mobile (not fixed) - Smooth animated hamburger icon (3 lines → X) - Mobile menu slides down with all navigation links - Reduced hero padding since nav no longer overlaps - Cleaner single-row mobile header Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent c11a4ed commit cda4820

1 file changed

Lines changed: 116 additions & 7 deletions

File tree

homepage/index.html

Lines changed: 116 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,74 @@
124124
filter: invert(1);
125125
}
126126

127+
/* Hamburger Menu */
128+
.hamburger {
129+
display: none;
130+
flex-direction: column;
131+
gap: 5px;
132+
background: transparent;
133+
border: none;
134+
cursor: pointer;
135+
padding: 8px;
136+
}
137+
138+
.hamburger span {
139+
width: 24px;
140+
height: 2px;
141+
background: var(--accent-green);
142+
transition: all 0.3s;
143+
border-radius: 2px;
144+
}
145+
146+
.hamburger.active span:nth-child(1) {
147+
transform: rotate(45deg) translate(7px, 7px);
148+
}
149+
150+
.hamburger.active span:nth-child(2) {
151+
opacity: 0;
152+
}
153+
154+
.hamburger.active span:nth-child(3) {
155+
transform: rotate(-45deg) translate(7px, -7px);
156+
}
157+
158+
.mobile-menu {
159+
display: none;
160+
position: fixed;
161+
top: 60px;
162+
left: 0;
163+
right: 0;
164+
background: var(--bg-darker);
165+
border-bottom: 1px solid var(--border-color);
166+
max-height: 0;
167+
overflow: hidden;
168+
transition: max-height 0.3s ease;
169+
z-index: 99;
170+
}
171+
172+
.mobile-menu.active {
173+
max-height: 400px;
174+
}
175+
176+
.mobile-menu-content {
177+
display: flex;
178+
flex-direction: column;
179+
padding: 16px;
180+
gap: 8px;
181+
}
182+
183+
.mobile-menu-content a {
184+
padding: 12px 16px;
185+
border-radius: 6px;
186+
color: var(--text-light);
187+
font-size: 0.9rem;
188+
transition: background 0.2s;
189+
}
190+
191+
.mobile-menu-content a:hover {
192+
background: var(--bg-card);
193+
}
194+
127195
/* Hero Section */
128196
.hero {
129197
min-height: 100vh;
@@ -754,17 +822,34 @@
754822

755823
/* Responsive */
756824
@media (max-width: 768px) {
757-
.nav-links {
758-
gap: 16px;
825+
nav {
826+
position: relative;
759827
}
760828

761-
.nav-links > a[href^="#"] {
829+
.nav-container {
830+
height: 60px;
831+
flex-direction: row;
832+
align-items: center;
833+
justify-content: space-between;
834+
padding: 0 16px;
835+
}
836+
837+
.nav-logo {
838+
width: auto;
839+
}
840+
841+
.nav-links {
762842
display: none;
763843
}
764844

765-
.btn-github {
766-
padding: 6px 12px;
767-
font-size: 0.8rem;
845+
.hamburger {
846+
display: flex;
847+
}
848+
849+
.mobile-menu {
850+
display: block;
851+
position: absolute;
852+
top: 60px;
768853
}
769854

770855
#version-badge {
@@ -790,7 +875,7 @@
790875
}
791876

792877
.hero {
793-
padding: 60px 16px 24px;
878+
padding: 40px 16px 24px;
794879
min-height: auto;
795880
justify-content: flex-start;
796881
}
@@ -897,6 +982,11 @@
897982
<a href="#" class="nav-logo">
898983
>_ Fresh <span id="version-badge"></span>
899984
</a>
985+
<button class="hamburger" onclick="toggleMobileMenu()" aria-label="Menu">
986+
<span></span>
987+
<span></span>
988+
<span></span>
989+
</button>
900990
<div class="nav-links">
901991
<a href="#features">Features</a>
902992
<a href="#install">Install</a>
@@ -914,6 +1004,18 @@
9141004
</div>
9151005
</nav>
9161006

1007+
<!-- Mobile Menu -->
1008+
<div class="mobile-menu" id="mobile-menu">
1009+
<div class="mobile-menu-content">
1010+
<a href="#features" onclick="toggleMobileMenu()">Features</a>
1011+
<a href="#install" onclick="toggleMobileMenu()">Install</a>
1012+
<a href="docs/">Docs</a>
1013+
<a href="https://github.com/sinelaw/fresh/blob/master/CHANGELOG.md" target="_blank">Changelog</a>
1014+
<a href="https://discord.gg/qUutBj9t" target="_blank">Discord</a>
1015+
<a href="https://github.com/sinelaw/fresh" target="_blank">GitHub</a>
1016+
</div>
1017+
</div>
1018+
9171019
<!-- Hero Section -->
9181020
<section class="hero">
9191021
<div class="hero-content">
@@ -1239,6 +1341,13 @@ <h2>What People Are Saying</h2>
12391341
</footer>
12401342

12411343
<script>
1344+
function toggleMobileMenu() {
1345+
const menu = document.getElementById('mobile-menu');
1346+
const hamburger = document.querySelector('.hamburger');
1347+
menu.classList.toggle('active');
1348+
hamburger.classList.toggle('active');
1349+
}
1350+
12421351
function copyCode(elementId, btn) {
12431352
const text = document.getElementById(elementId).textContent;
12441353
navigator.clipboard.writeText(text).then(() => {

0 commit comments

Comments
 (0)