|
1 | 1 | <template> |
2 | 2 | <div class="app"> |
3 | 3 | <!-- HEADER --> |
4 | | - <header class="site-header"> |
| 4 | + <transition name="menu-fade"> |
| 5 | + <header class="site-header" :class="{ 'is-open': isOpen }"> |
5 | 6 | <div class="container header-inner"> |
6 | | - <div class="brand"> |
| 7 | + <div class="brand" :class="{ 'is-open': isOpen }"> |
7 | 8 | <a href="/"> |
8 | 9 | <img :src="Logo" alt="Logo" class="brand-logo"/> |
9 | 10 | <span class="brand-title">TheCode</span> |
10 | 11 | </a> |
11 | 12 | </div> |
12 | 13 |
|
13 | | - <div class="hamburger-menu"> |
14 | | - <button class="hamburger" @click="toggleMenu">☰</button> |
15 | | - <transition name="menu-fade"> |
16 | | - <div v-if="isOpen" class="mobile-nav"> |
17 | | - <button class="hamburger close-btn" @click="closeMenu">✕</button> |
18 | | - <nav aria-label="Phone Navigation"> |
| 14 | + <nav aria-label="large nav" class="large_nav"> |
| 15 | + <router-link to="/" exact @click="closeMenu">Accueil</router-link> |
| 16 | + <router-link to="/generate" @click="closeMenu">Générateur</router-link> |
| 17 | + <router-link to="/privacy" @click="closeMenu">Confidentialité</router-link> |
| 18 | + </nav> |
| 19 | + |
| 20 | + |
| 21 | + <div class="hamburger-menu"> |
| 22 | + <div v-if="isOpen"> |
| 23 | + <nav aria-label="small nav" class="small_nav"> |
19 | 24 | <router-link to="/" exact @click="closeMenu">Accueil</router-link> |
20 | 25 | <router-link to="/generate" @click="closeMenu">Générateur</router-link> |
21 | 26 | <router-link to="/privacy" @click="closeMenu">Confidentialité</router-link> |
22 | 27 | </nav> |
23 | 28 | </div> |
24 | | - </transition> |
25 | | - <div class="nav"> |
26 | | - <nav aria-label="Big Navigation"> |
27 | | - <router-link to="/" exact @click="closeMenu">Accueil</router-link> |
28 | | - <router-link to="/generate" @click="closeMenu">Générateur</router-link> |
29 | | - <router-link to="/privacy" @click="closeMenu">Confidentialité</router-link> |
30 | | - </nav> |
| 29 | + <button v-if="!isOpen" id="open-btn" @click="toggleMenu">☰</button> |
| 30 | + <button v-if="isOpen" id="close-btn" @click="closeMenu">✕</button> |
31 | 31 | </div> |
32 | | - </div> |
33 | 32 | </div> |
34 | 33 | </header> |
| 34 | + </transition> |
35 | 35 |
|
36 | 36 | <!-- MAIN CONTENT --> |
37 | 37 | <main class="main"> |
@@ -96,6 +96,10 @@ export default defineComponent({ |
96 | 96 | box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4); |
97 | 97 | backdrop-filter: saturate(180%) blur(20px); |
98 | 98 | -webkit-backdrop-filter: saturate(180%) blur(20px); |
| 99 | + transition: max-height 0.4s ease, opacity 0.4s ease; |
| 100 | + max-height: 25px; |
| 101 | + height: 100vh; |
| 102 | + overflow: hidden; |
99 | 103 | } |
100 | 104 |
|
101 | 105 | .container { |
@@ -139,121 +143,109 @@ export default defineComponent({ |
139 | 143 | margin: auto auto auto 20px; |
140 | 144 | } |
141 | 145 |
|
142 | | -.nav a { |
| 146 | +.large_nav a { |
143 | 147 | margin-left: 25px; |
144 | 148 | text-decoration: none; |
145 | 149 | font-weight: 500; |
146 | 150 | padding-bottom: 4px; |
147 | 151 | color: black; |
148 | 152 | } |
149 | 153 |
|
150 | | -.nav a:hover { |
| 154 | +.large_nav a:hover, .small_nav a:hover { |
151 | 155 | color: #6A1E55; |
152 | 156 | } |
153 | 157 |
|
154 | | -.nav .router-link-exact-active { |
| 158 | +.large_nav .router-link-exact-active, .small_nav .router-link-exact-active { |
155 | 159 | font-weight: bold; |
156 | 160 | } |
157 | 161 |
|
158 | | -.main { |
159 | | - flex: 1; |
160 | | - display: flex; |
161 | | - flex-direction: column; |
162 | | -} |
163 | | -
|
164 | | -.site-footer { |
165 | | - background: var(--c2); |
166 | | - text-align: center; |
167 | | - padding: 15px 0; |
168 | | - font-size: 0.85rem; |
169 | | - color: #ddd; |
170 | | - border-top: 1px solid rgba(255, 255, 255, 0.05); |
171 | | -} |
172 | | -
|
173 | | -.hamburger { |
174 | | - display: none; |
175 | | -} |
176 | | -
|
177 | | -.mobile-nav { |
178 | | - display: none; |
179 | | - position: fixed; |
180 | | - top: 0; |
| 162 | +.small_nav { |
| 163 | + position: absolute; |
| 164 | + display: grid; |
181 | 165 | left: 0; |
| 166 | + top: 50px; |
182 | 167 | width: 100vw; |
183 | | - height: 100vh; |
184 | | - background: rgba(245, 245, 247, 1); |
185 | | - flex-direction: column; |
186 | | - align-items: center; |
187 | | - justify-content: center; |
188 | | - gap: 30px; |
189 | | - z-index: 2000; |
190 | | - transform: translateY(0); |
191 | 168 | } |
192 | 169 |
|
193 | | -.mobile-nav nav { |
| 170 | +.small_nav nav { |
194 | 171 | display: flex; |
195 | 172 | flex-direction: column; |
196 | 173 | gap: 20px; |
197 | 174 | width: 100%; |
198 | 175 | padding: 20px; |
199 | 176 | } |
200 | 177 |
|
201 | | -.mobile-nav a { |
| 178 | +.small_nav a { |
| 179 | + margin: 20px; |
| 180 | + padding: 10px 0; |
202 | 181 | color: var(--text); |
203 | 182 | font-size: 1.5rem; |
204 | 183 | text-decoration: none; |
205 | | - margin: 20px; |
206 | 184 | font-weight: 400; |
207 | | - transition: color 0.2s, font-weight 0.4s; |
| 185 | + transition: color 0.4s; |
208 | 186 | } |
209 | 187 |
|
210 | | -.mobile-nav a:hover { |
211 | | - color: #6A1E55; |
212 | | - font-weight: 700; |
| 188 | +.main { |
| 189 | + flex: 1; |
| 190 | + display: flex; |
| 191 | + flex-direction: column; |
| 192 | +} |
| 193 | +
|
| 194 | +.site-footer { |
| 195 | + background: var(--c2); |
| 196 | + text-align: center; |
| 197 | + padding: 15px 0; |
| 198 | + font-size: 0.85rem; |
| 199 | + color: #ddd; |
| 200 | + border-top: 1px solid rgba(255, 255, 255, 0.05); |
213 | 201 | } |
214 | 202 |
|
215 | | -.close-btn { |
| 203 | +button { |
216 | 204 | position: absolute; |
217 | | - top: 20px; |
| 205 | + top: 10px; |
218 | 206 | right: 25px; |
219 | 207 | background: none; |
220 | 208 | border: none; |
221 | 209 | font-size: 2rem; |
222 | 210 | color: var(--text); |
223 | 211 | cursor: pointer; |
| 212 | + display: none; |
| 213 | +} |
| 214 | +
|
| 215 | +.hamburger-menu { |
| 216 | + display: none; |
224 | 217 | } |
225 | 218 |
|
226 | 219 | /* TRANSITION ANIMATION */ |
227 | 220 | .menu-fade-enter-active, |
228 | 221 | .menu-fade-leave-active { |
229 | 222 | transition: opacity 0.4s ease; |
230 | 223 | } |
| 224 | +
|
231 | 225 | .menu-fade-enter-from, |
232 | 226 | .menu-fade-leave-to { |
233 | 227 | opacity: 0; |
234 | 228 | } |
235 | 229 |
|
236 | 230 | @media (max-width: 550px) { |
| 231 | + .site-header.is-open { |
| 232 | + max-height: 100vh; |
| 233 | + } |
| 234 | +
|
| 235 | + .large_nav { |
| 236 | + display: none; |
| 237 | + } |
| 238 | +
|
237 | 239 | .hamburger-menu { |
238 | | - position: relative; |
239 | | - display: inline-block; |
| 240 | + display: flex; |
240 | 241 | } |
241 | 242 |
|
242 | | - .hamburger { |
243 | | - font-size: 2rem; |
244 | | - background: none; |
245 | | - border: none; |
246 | | - color: var(--c3); |
247 | | - cursor: pointer; |
| 243 | + button { |
248 | 244 | display: block; |
249 | 245 | } |
250 | 246 |
|
251 | | - .nav { |
| 247 | + .brand:is(.is-open) { |
252 | 248 | display: none; |
253 | 249 | } |
254 | | -
|
255 | | - .mobile-nav { |
256 | | - display: flex; |
257 | | - } |
258 | 250 | } |
259 | 251 | </style> |
0 commit comments