Skip to content

Commit 1d2ac69

Browse files
committed
Fix mobile
1 parent 9a0ca15 commit 1d2ac69

3 files changed

Lines changed: 81 additions & 10 deletions

File tree

src/components/Footer.astro

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ const icons: Record<string, string> = {
7777
<p class="text-gray-400 text-sm max-w-md mb-4">
7878
A fan-made continuation patch for Kerbal Space Program 2, focused on bug fixing, performance work, UI cleanup, and the larger systems still planned on the roadmap.
7979
</p>
80-
<div class="flex space-x-4">
80+
<div class="footer-social-links">
8181
{socialLinks.map(link => (
8282
<a
8383
href={link.url}
@@ -143,6 +143,16 @@ const icons: Record<string, string> = {
143143
</footer>
144144

145145
<style>
146+
.footer-social-links {
147+
display: flex;
148+
flex-wrap: wrap;
149+
gap: 1rem !important;
150+
}
151+
152+
.footer-social-links > * {
153+
margin-left: 0 !important;
154+
}
155+
146156
.footer-social-icon {
147157
display: block;
148158
width: 1.5rem;

src/components/Header.astro

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ const isActive = (href: string) => {
8080
id="mobile-menu-button"
8181
class="md:hidden text-gray-300 hover:text-white focus:outline-none"
8282
aria-label="Toggle menu"
83+
aria-controls="mobile-menu"
84+
aria-expanded="false"
8385
>
8486
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
8587
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
@@ -92,7 +94,14 @@ const isActive = (href: string) => {
9294
<div id="mobile-menu" class="hidden md:hidden pb-4 px-4 border-t border-white/10">
9395
<div class="flex flex-col space-y-3 pt-4">
9496
{navItems.map(item => (
95-
<a href={item.href} class="text-gray-300 hover:text-white transition-colors py-2">
97+
<a
98+
href={item.href}
99+
class:list={[
100+
"transition-colors py-2 font-medium",
101+
isActive(item.href) ? "text-ksp-red" : "text-gray-300 hover:text-white"
102+
]}
103+
aria-current={isActive(item.href) ? 'page' : undefined}
104+
>
96105
{item.label}
97106
</a>
98107
))}
@@ -105,8 +114,29 @@ const isActive = (href: string) => {
105114
// Mobile menu toggle
106115
const button = document.getElementById('mobile-menu-button');
107116
const menu = document.getElementById('mobile-menu');
117+
const menuLinks = menu?.querySelectorAll('a');
118+
119+
const setMenuExpanded = (expanded) => {
120+
button?.setAttribute('aria-expanded', expanded ? 'true' : 'false');
121+
};
122+
123+
const closeMenu = () => {
124+
menu?.classList.add('hidden');
125+
setMenuExpanded(false);
126+
};
108127

109128
button?.addEventListener('click', () => {
110-
menu?.classList.toggle('hidden');
129+
const isHidden = menu?.classList.toggle('hidden');
130+
setMenuExpanded(!isHidden);
131+
});
132+
133+
menuLinks?.forEach((link) => {
134+
link.addEventListener('click', closeMenu);
135+
});
136+
137+
document.addEventListener('keydown', (event) => {
138+
if (event.key === 'Escape') {
139+
closeMenu();
140+
}
111141
});
112142
</script>

src/styles/global.css

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,6 @@
147147
font-weight: 700 !important;
148148
}
149149

150-
button {
151-
color: #ffffff !important;
152-
font-weight: 700 !important;
153-
}
154-
155150
/* Starlight button styling */
156151
.sl-button,
157152
[class*='button'][class*='primary'],
@@ -1129,6 +1124,38 @@ body:has(#starlight__sidebar a[aria-current="page"][href^="/blog/"]) main[data-p
11291124
margin-left: 0.75rem !important;
11301125
}
11311126

1127+
nav[aria-label='Main'] button[aria-label='Menu'] {
1128+
display: inline-flex;
1129+
align-items: center;
1130+
justify-content: center;
1131+
border: 1px solid rgba(255, 255, 255, 0.16) !important;
1132+
border-radius: 999px;
1133+
background-color: #0a0a0a !important;
1134+
color: #ffffff !important;
1135+
-webkit-text-fill-color: #ffffff !important;
1136+
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
1137+
}
1138+
1139+
:root[data-theme='light'] nav[aria-label='Main'] button[aria-label='Menu'] {
1140+
border-color: rgba(10, 10, 10, 0.16) !important;
1141+
background-color: #ffffff !important;
1142+
color: #0a0a0a !important;
1143+
-webkit-text-fill-color: #0a0a0a !important;
1144+
}
1145+
1146+
nav[aria-label='Main'] button[aria-label='Menu'] svg,
1147+
nav[aria-label='Main'] button[aria-label='Menu'] path {
1148+
color: inherit !important;
1149+
stroke: #ffffff !important;
1150+
fill: none !important;
1151+
}
1152+
1153+
:root[data-theme='light'] nav[aria-label='Main'] button[aria-label='Menu'] svg,
1154+
:root[data-theme='light'] nav[aria-label='Main'] button[aria-label='Menu'] path {
1155+
color: #0a0a0a !important;
1156+
stroke: #0a0a0a !important;
1157+
}
1158+
11321159
/* Footer styling overrides for Starlight compatibility */
11331160
.site-footer {
11341161
margin-top: 4rem;
@@ -1138,13 +1165,17 @@ body:has(#starlight__sidebar a[aria-current="page"][href^="/blog/"]) main[data-p
11381165

11391166
.site-footer .grid {
11401167
display: grid !important;
1141-
grid-template-columns: 1fr !important;
1168+
grid-template-columns: minmax(0, 1fr) !important;
11421169
gap: 2rem !important;
11431170
}
11441171

1172+
.site-footer .grid > * {
1173+
min-width: 0;
1174+
}
1175+
11451176
@media (min-width: 768px) {
11461177
.site-footer .grid {
1147-
grid-template-columns: 2fr 1fr 1fr !important;
1178+
grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) !important;
11481179
}
11491180
}
11501181

0 commit comments

Comments
 (0)