|
13 | 13 |
|
14 | 14 | function closeMobile() { |
15 | 15 | mobileOpen = false; |
| 16 | + document.body.style.overflow = ''; |
| 17 | + } |
| 18 | +
|
| 19 | + function toggleMobile() { |
| 20 | + mobileOpen = !mobileOpen; |
| 21 | + document.body.style.overflow = mobileOpen ? 'hidden' : ''; |
16 | 22 | } |
17 | 23 | </script> |
18 | 24 |
|
|
34 | 40 |
|
35 | 41 | <button |
36 | 42 | class="mobile-toggle mobile-only" |
37 | | - onclick={() => mobileOpen = !mobileOpen} |
| 43 | + onclick={toggleMobile} |
38 | 44 | aria-label="Toggle menu" |
39 | 45 | aria-expanded={mobileOpen} |
| 46 | + type="button" |
40 | 47 | > |
41 | 48 | {#if mobileOpen} |
42 | 49 | <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"> |
|
50 | 57 | </button> |
51 | 58 | </div> |
52 | 59 | </div> |
| 60 | +</nav> |
53 | 61 |
|
54 | | - {#if mobileOpen} |
55 | | - <div class="mobile-menu mobile-only"> |
56 | | - <div class="mobile-menu-inner"> |
57 | | - {#each navLinks as link} |
58 | | - <a href={link.href} class="mobile-link" onclick={closeMobile}>{link.label}</a> |
59 | | - {/each} |
60 | | - <hr /> |
61 | | - <a href="/docs#installation" class="btn btn-primary mobile-cta"> |
62 | | - Get Started |
63 | | - </a> |
64 | | - </div> |
| 62 | +{#if mobileOpen} |
| 63 | + <div class="mobile-menu"> |
| 64 | + <div class="mobile-menu-inner"> |
| 65 | + {#each navLinks as link} |
| 66 | + <a href={link.href} class="mobile-link" onclick={closeMobile}>{link.label}</a> |
| 67 | + {/each} |
| 68 | + <hr /> |
| 69 | + <a href="/docs#installation" class="btn btn-primary mobile-cta"> |
| 70 | + Get Started |
| 71 | + </a> |
65 | 72 | </div> |
66 | | - {/if} |
67 | | -</nav> |
| 73 | + </div> |
| 74 | +{/if} |
68 | 75 |
|
69 | 76 | <style> |
70 | 77 | .navbar { |
|
78 | 85 | -webkit-backdrop-filter: blur(12px); |
79 | 86 | border-bottom: 1px solid var(--nav-border); |
80 | 87 | height: var(--nav-height); |
| 88 | + width: 100%; |
| 89 | + max-width: 100vw; |
| 90 | + overflow: visible; |
81 | 91 | } |
82 | 92 |
|
83 | 93 | .navbar-inner { |
84 | 94 | display: flex; |
85 | 95 | align-items: center; |
86 | 96 | justify-content: space-between; |
87 | 97 | height: 100%; |
| 98 | + width: 100%; |
| 99 | + max-width: 100%; |
| 100 | + overflow: hidden; |
88 | 101 | } |
89 | 102 |
|
90 | 103 | .nav-links { |
|
111 | 124 | display: flex; |
112 | 125 | align-items: center; |
113 | 126 | gap: 8px; |
| 127 | + flex-shrink: 0; |
114 | 128 | } |
115 | 129 |
|
116 | 130 | .btn { |
|
140 | 154 | justify-content: center; |
141 | 155 | width: 36px; |
142 | 156 | height: 36px; |
| 157 | + min-width: 36px; |
143 | 158 | color: var(--text-secondary); |
144 | 159 | border-radius: var(--radius-sm); |
| 160 | + flex-shrink: 0; |
| 161 | + cursor: pointer; |
145 | 162 | } |
146 | 163 |
|
147 | 164 | .mobile-toggle:hover { |
148 | 165 | background: var(--bg-tertiary); |
149 | 166 | } |
150 | 167 |
|
151 | 168 | .mobile-menu { |
152 | | - position: fixed; |
153 | | - top: var(--nav-height); |
154 | | - left: 0; |
155 | | - right: 0; |
156 | | - bottom: 0; |
157 | | - background: var(--bg-primary); |
158 | | - z-index: 99; |
159 | | - overflow-y: auto; |
| 169 | + position: fixed !important; |
| 170 | + top: var(--nav-height) !important; |
| 171 | + left: 0 !important; |
| 172 | + right: 0 !important; |
| 173 | + bottom: 0 !important; |
| 174 | + background: var(--bg-primary) !important; |
| 175 | + z-index: 999 !important; |
| 176 | + overflow-y: auto !important; |
| 177 | + overflow-x: hidden !important; |
| 178 | + width: 100vw !important; |
| 179 | + max-width: 100vw !important; |
| 180 | + -webkit-overflow-scrolling: touch; |
| 181 | + display: block !important; |
| 182 | + visibility: visible !important; |
| 183 | + opacity: 1 !important; |
| 184 | + margin: 0 !important; |
| 185 | + padding: 0 !important; |
| 186 | + } |
| 187 | +
|
| 188 | + /* Hide on desktop */ |
| 189 | + @media (min-width: 769px) { |
| 190 | + .mobile-menu { |
| 191 | + display: none !important; |
| 192 | + } |
160 | 193 | } |
161 | 194 |
|
162 | 195 | .mobile-menu-inner { |
163 | | - display: flex; |
164 | | - flex-direction: column; |
165 | | - padding: 16px; |
166 | | - gap: 4px; |
| 196 | + display: flex !important; |
| 197 | + flex-direction: column !important; |
| 198 | + padding: 16px !important; |
| 199 | + gap: 4px !important; |
| 200 | + width: 100% !important; |
| 201 | + max-width: 100% !important; |
| 202 | + box-sizing: border-box !important; |
| 203 | + min-height: 200px !important; |
167 | 204 | } |
168 | 205 |
|
169 | 206 | .mobile-link { |
|
173 | 210 | color: var(--text-secondary); |
174 | 211 | border-radius: var(--radius-sm); |
175 | 212 | transition: background var(--transition-fast); |
| 213 | + display: block; |
| 214 | + text-decoration: none; |
176 | 215 | } |
177 | 216 |
|
178 | 217 | .mobile-link:hover { |
|
201 | 240 | } |
202 | 241 |
|
203 | 242 | @media (max-width: 768px) { |
| 243 | + .navbar-inner { |
| 244 | + padding: 0 12px; |
| 245 | + } |
| 246 | +
|
204 | 247 | .desktop-only { |
205 | 248 | display: none !important; |
206 | 249 | } |
207 | 250 |
|
208 | 251 | .mobile-only { |
209 | 252 | display: flex; |
210 | 253 | } |
| 254 | +
|
| 255 | + .mobile-menu { |
| 256 | + display: block !important; |
| 257 | + } |
| 258 | +
|
| 259 | + .nav-actions { |
| 260 | + gap: 4px; |
| 261 | + } |
211 | 262 | } |
212 | 263 | </style> |
0 commit comments