@@ -279,7 +279,66 @@ <h2 id="search-title" class="sr-only">Search</h2>
279279 < a href ="{{ config.extra.github }} " class ="header__icon-link " aria-label ="View project on GitHub (opens in new tab) " target ="_blank " rel ="noopener noreferrer " title ="GitHub "> < svg xmlns ="http://www.w3.org/2000/svg " width ="20 " height ="20 " viewBox ="0 0 24 24 " fill ="currentColor " aria-hidden ="true "> < path d ="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z "/> </ svg > </ a >
280280 {% endif %}
281281 </ div >
282+
283+ {# Mobile menu toggle #}
284+ < button class ="header__mobile-toggle " type ="button " aria-label ="Toggle menu " aria-expanded ="false ">
285+ < svg class ="header__mobile-icon header__mobile-icon--menu " xmlns ="http://www.w3.org/2000/svg " width ="24 " height ="24 " viewBox ="0 0 24 24 " fill ="none " stroke ="currentColor " stroke-width ="2 " stroke-linecap ="round " stroke-linejoin ="round " aria-hidden ="true ">
286+ < line x1 ="3 " y1 ="6 " x2 ="21 " y2 ="6 "/>
287+ < line x1 ="3 " y1 ="12 " x2 ="21 " y2 ="12 "/>
288+ < line x1 ="3 " y1 ="18 " x2 ="21 " y2 ="18 "/>
289+ </ svg >
290+ < svg class ="header__mobile-icon header__mobile-icon--close " xmlns ="http://www.w3.org/2000/svg " width ="24 " height ="24 " viewBox ="0 0 24 24 " fill ="none " stroke ="currentColor " stroke-width ="2 " stroke-linecap ="round " stroke-linejoin ="round " aria-hidden ="true ">
291+ < line x1 ="18 " y1 ="6 " x2 ="6 " y2 ="18 "/>
292+ < line x1 ="6 " y1 ="6 " x2 ="18 " y2 ="18 "/>
293+ </ svg >
294+ </ button >
282295 </ div >
283296 </ div >
297+
298+ {# Mobile navigation dropdown #}
299+ < nav class ="header__mobile-nav " role ="navigation " aria-label ="Mobile navigation ">
300+ < div class ="header__mobile-nav-inner ">
301+ {% if config.extra.nav %}
302+ {% for link in config.extra.nav %}
303+ < a href ="{{ link.url | safe }} " class ="header__mobile-link "> {{ link.name }}</ a >
304+ {% endfor %}
305+ {% elif config.extra.nav_links %}
306+ {% for link in config.extra.nav_links %}
307+ < a href ="{{ link.url | safe }} " class ="header__mobile-link "> {{ link.name }}</ a >
308+ {% endfor %}
309+ {% endif %}
310+ {% if config.extra.github %}
311+ < a href ="{{ config.extra.github }} " class ="header__mobile-link " target ="_blank " rel ="noopener noreferrer ">
312+ < svg xmlns ="http://www.w3.org/2000/svg " width ="18 " height ="18 " viewBox ="0 0 24 24 " fill ="currentColor " aria-hidden ="true "> < path d ="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z "/> </ svg >
313+ < span > GitHub</ span >
314+ </ a >
315+ {% endif %}
316+ </ div >
317+ </ nav >
284318</ header >
319+
320+ < script >
321+ ( function ( ) {
322+ const header = document . querySelector ( '.header' ) ;
323+ const toggle = document . querySelector ( '.header__mobile-toggle' ) ;
324+ const mobileNav = document . querySelector ( '.header__mobile-nav' ) ;
325+
326+ if ( toggle && mobileNav && header ) {
327+ toggle . addEventListener ( 'click' , function ( ) {
328+ const isOpen = header . classList . toggle ( 'header--mobile-open' ) ;
329+ toggle . setAttribute ( 'aria-expanded' , isOpen ) ;
330+ document . body . classList . toggle ( 'mobile-menu-open' , isOpen ) ;
331+ } ) ;
332+
333+ // Close menu when clicking a link
334+ mobileNav . querySelectorAll ( 'a' ) . forEach ( link => {
335+ link . addEventListener ( 'click' , ( ) => {
336+ header . classList . remove ( 'header--mobile-open' ) ;
337+ toggle . setAttribute ( 'aria-expanded' , 'false' ) ;
338+ document . body . classList . remove ( 'mobile-menu-open' ) ;
339+ } ) ;
340+ } ) ;
341+ }
342+ } ) ( ) ;
343+ </ script >
285344{% endif %}
0 commit comments