11---
22import { SOCIAL , SITE_TITLE } from ' ../consts' ;
3+ import GitHubIcon from ' ./icons/GitHubIcon.astro' ;
4+ import XIcon from ' ./icons/XIcon.astro' ;
35
46interface Props {
57 isHome? : boolean ;
@@ -8,14 +10,19 @@ interface Props {
810const { isHome = false } = Astro .props ;
911---
1012
11- <nav class =" site-nav" >
13+ <nav class =" site-nav" aria-label = " Main navigation " >
1214 <div class =" site-nav-left" >
1315 { ! isHome && (
1416 <a class = " site-nav-logo" href = " /" >
1517 <img src = " /images/furystack-logo-512.png" alt = { SITE_TITLE } />
1618 <span >FuryStack</span >
1719 </a >
1820 )}
21+ <button class =" nav-toggle" aria-label =" Toggle navigation" aria-expanded =" false" >
22+ <span class =" nav-toggle-bar" ></span >
23+ <span class =" nav-toggle-bar" ></span >
24+ <span class =" nav-toggle-bar" ></span >
25+ </button >
1926 <ul class =" nav" role =" menu" >
2027 <li role =" menuitem" ><a href =" /" >Home</a ></li >
2128 <li role =" menuitem" ><a href =" /tags/getting-started/" >Getting Started</a ></li >
@@ -26,17 +33,31 @@ const { isHome = false } = Astro.props;
2633 <div class =" site-nav-right" >
2734 { SOCIAL .github && (
2835 <a class = " social-link" href = { SOCIAL .github } target = " _blank" rel = " noopener noreferrer" title = " GitHub" >
29- <svg xmlns = " http://www.w3.org/2000/svg " width = " 18 " height = " 18 " fill = " currentColor " viewBox = " 0 0 16 16 " >< path d = " M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.012 8.012 0 0 0 16 8c0-4.42-3.58-8-8-8z " /></ svg >
36+ <GitHubIcon / >
3037 </a >
3138 )}
3239 { SOCIAL .x && (
3340 <a class = " social-link" href = { SOCIAL .x } target = " _blank" rel = " noopener noreferrer" title = " X (Twitter)" >
34- <svg xmlns = " http://www.w3.org/2000/svg " width = " 16 " height = " 16 " fill = " currentColor " viewBox = " 0 0 16 16 " >< path d = " M12.6.75h2.454l-5.36 6.142L16 15.25h-4.937l-3.867-5.07-4.425 5.07H.316l5.733-6.57L0 .75h5.063l3.495 4.633L12.601.75Zm-.86 13.028h1.36L4.323 2.145H2.865z " /></ svg >
41+ <XIcon / >
3542 </a >
3643 )}
3744 </div >
3845</nav >
3946
47+ <script >
48+ document.addEventListener('astro:page-load', () => {
49+ const toggle = document.querySelector('.nav-toggle');
50+ const nav = document.querySelector('.site-nav .nav');
51+ if (!toggle || !nav) return;
52+
53+ toggle.addEventListener('click', () => {
54+ const expanded = toggle.getAttribute('aria-expanded') === 'true';
55+ toggle.setAttribute('aria-expanded', String(!expanded));
56+ nav.classList.toggle('nav-open');
57+ });
58+ });
59+ </script >
60+
4061<style >
4162 .site-nav {
4263 position: relative;
@@ -69,6 +90,30 @@ const { isHome = false } = Astro.props;
6990 .site-nav-logo:hover { text-decoration: none; opacity: 0.9; }
7091 .site-nav-logo img { width: 24px; height: 24px; border-radius: 4px; }
7192
93+ .nav-toggle {
94+ display: none;
95+ flex-direction: column;
96+ justify-content: center;
97+ gap: 4px;
98+ width: 36px;
99+ height: 36px;
100+ padding: 8px;
101+ background: transparent;
102+ border: none;
103+ cursor: pointer;
104+ border-radius: 6px;
105+ transition: background 0.15s ease;
106+ }
107+ .nav-toggle:hover { background: rgba(255, 255, 255, 0.08); }
108+ .nav-toggle-bar {
109+ display: block;
110+ width: 100%;
111+ height: 2px;
112+ background: rgba(255, 255, 255, 0.75);
113+ border-radius: 1px;
114+ transition: transform 0.2s ease, opacity 0.2s ease;
115+ }
116+
72117 .nav {
73118 display: flex;
74119 gap: 2px;
@@ -92,8 +137,21 @@ const { isHome = false } = Astro.props;
92137 }
93138
94139 @media (max-width: 700px) {
95- .nav { gap: 0; }
96- .nav li a { padding: 8px 8px; font-size: 1.3rem; }
140+ .nav-toggle { display: flex; }
141+ .nav {
142+ display: none;
143+ position: absolute;
144+ top: 64px;
145+ left: 0;
146+ right: 0;
147+ flex-direction: column;
148+ background: var(--color-nav-bg);
149+ padding: 8px 16px 16px;
150+ border-top: 1px solid rgba(255, 255, 255, 0.08);
151+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
152+ }
153+ .nav.nav-open { display: flex; }
154+ .nav li a { padding: 10px 12px; font-size: 1.5rem; }
97155 .site-nav-logo span { display: none; }
98156 .site-nav-logo { margin-right: 8px; }
99157 .site-nav-left { padding-left: 5vw; }
0 commit comments