Skip to content

Commit 87659cf

Browse files
authored
Merge pull request #19 from rtk-ai/fix/uiux/responsive
fix(uiux): responsive navbar & clean legacy pages
2 parents 7e7619d + 6ced8dd commit 87659cf

22 files changed

Lines changed: 152 additions & 2442 deletions
-121 KB
Binary file not shown.

public/og-vs.png

-50.3 KB
Binary file not shown.

src/components/global/Header.astro

Lines changed: 21 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -29,38 +29,20 @@ import IconGitHub from '../ui/icons/IconGitHub.astro'
2929
</a>
3030
</nav>
3131

32-
<!-- Mobile right: search + hamburger -->
32+
<!-- Mobile right: search + sidebar toggle -->
3333
<div class="header-mobile-right">
3434
<button id="docs-search-trigger-mobile" class="header-icon-btn" aria-label="Search">
3535
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="18" height="18" aria-hidden="true">
3636
<circle cx="11" cy="11" r="8"/><path d="m21 21-4.35-4.35"/>
3737
</svg>
3838
</button>
39-
<button class="header-icon-btn header-hamburger" id="docs-hamburger" aria-label="Open menu" aria-expanded="false" aria-controls="docs-drawer">
39+
<button class="header-icon-btn header-hamburger" id="docs-hamburger" aria-label="Open docs navigation" aria-expanded="false" aria-controls="starlight__sidebar">
4040
<span></span><span></span><span></span>
4141
</button>
4242
</div>
4343
</div>
4444
</header>
4545

46-
<!-- Mobile drawer -->
47-
<div class="docs-drawer" id="docs-drawer" aria-hidden="true">
48-
<div class="docs-drawer-inner">
49-
<div class="docs-drawer-links">
50-
<a href="/#problem">Why</a>
51-
<a href="/#install">Install</a>
52-
<a href="/guide/" class="active">Docs</a>
53-
</div>
54-
<div class="docs-drawer-actions">
55-
<a href="https://github.com/rtk-ai/rtk" target="_blank" rel="noopener">
56-
<IconGitHub size={14} />
57-
GitHub
58-
</a>
59-
</div>
60-
</div>
61-
</div>
62-
<div class="docs-overlay" id="docs-overlay"></div>
63-
6446
<style>
6547
.site-header {
6648
position: fixed;
@@ -130,10 +112,6 @@ import IconGitHub from '../ui/icons/IconGitHub.astro'
130112
text-decoration: none;
131113
}
132114
.header-link--active { color: var(--text); }
133-
.header-link--vox { color: #a78bfa; }
134-
.header-link--vox:hover { color: #a78bfa; background: rgba(167,139,250,0.08); }
135-
.header-link--icm { color: #38bdf8; }
136-
.header-link--icm:hover { color: #38bdf8; background: rgba(56,189,248,0.08); }
137115

138116
.header-btn-ghost {
139117
display: inline-flex;
@@ -203,8 +181,8 @@ import IconGitHub from '../ui/icons/IconGitHub.astro'
203181
display: flex;
204182
align-items: center;
205183
justify-content: center;
206-
width: 38px;
207-
height: 38px;
184+
width: 44px;
185+
height: 44px;
208186
border-radius: 8px;
209187
border: 1px solid var(--border);
210188
background: rgba(15, 22, 41, 0.6);
@@ -241,140 +219,41 @@ import IconGitHub from '../ui/icons/IconGitHub.astro'
241219
transform: translateY(-7px) rotate(-45deg);
242220
}
243221

244-
/* Drawer */
245-
.docs-drawer {
246-
position: fixed;
247-
top: 60px;
248-
right: 0;
249-
bottom: 0;
250-
width: min(280px, 80vw);
251-
background: var(--bg-alt);
252-
border-left: 1px solid var(--border);
253-
z-index: 200;
254-
transform: translateX(100%);
255-
transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1);
256-
display: none;
257-
}
258-
.docs-drawer.open {
259-
transform: translateX(0);
260-
}
261-
262-
.docs-drawer-inner {
263-
display: flex;
264-
flex-direction: column;
265-
padding: 24px 20px;
266-
height: 100%;
267-
gap: 32px;
268-
}
269-
270-
.docs-drawer-links {
271-
display: flex;
272-
flex-direction: column;
273-
gap: 4px;
274-
}
275-
.docs-drawer-links a {
276-
display: block;
277-
padding: 12px 16px;
278-
color: var(--text-muted);
279-
font-size: 1rem;
280-
font-weight: 500;
281-
text-decoration: none;
282-
border-radius: 8px;
283-
transition: color 150ms ease, background 150ms ease;
284-
}
285-
.docs-drawer-links a:hover {
286-
color: var(--text);
287-
background: var(--bg-card);
288-
}
289-
.docs-drawer-links a.active {
290-
color: var(--text);
291-
background: rgba(255,255,255,0.04);
292-
}
293-
294-
.docs-drawer-actions {
295-
display: flex;
296-
flex-direction: column;
297-
gap: 8px;
298-
}
299-
.docs-drawer-actions a {
300-
display: inline-flex;
301-
align-items: center;
302-
gap: 8px;
303-
padding: 10px 16px;
304-
color: var(--text-muted);
305-
font-size: 0.875rem;
306-
font-weight: 500;
307-
border-radius: 8px;
308-
border: 1px solid var(--border);
309-
text-decoration: none;
310-
transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
311-
}
312-
.docs-drawer-actions a:hover {
313-
color: var(--text);
314-
border-color: #243056;
315-
background: var(--bg-card);
316-
}
317-
318-
/* Overlay */
319-
.docs-overlay {
320-
display: none;
321-
position: fixed;
322-
inset: 60px 0 0 0;
323-
background: rgba(6, 11, 24, 0.6);
324-
backdrop-filter: blur(2px);
325-
z-index: 199;
326-
}
327-
.docs-overlay.open { display: block; }
328-
329-
@media (max-width: 768px) {
222+
@media (max-width: 50rem) {
330223
.header-inner {
331224
padding: 0 16px;
332-
gap: 0;
225+
gap: 8px;
333226
}
334227
.header-nav {
335228
display: none;
336229
}
337230
.header-mobile-right {
338231
display: flex;
339232
}
340-
.docs-drawer {
341-
display: block;
342-
}
343233
}
344234
</style>
345235

346236
<script>
347237
const hamburger = document.getElementById('docs-hamburger')
348-
const drawer = document.getElementById('docs-drawer')
349-
const overlay = document.getElementById('docs-overlay')
350238
const searchMobile = document.getElementById('docs-search-trigger-mobile')
351239
const searchDesktop = document.getElementById('search-trigger')
352240

353-
function openDrawer() {
354-
drawer?.classList.add('open')
355-
overlay?.classList.add('open')
356-
hamburger?.setAttribute('aria-expanded', 'true')
357-
drawer?.setAttribute('aria-hidden', 'false')
358-
document.body.style.overflow = 'hidden'
359-
}
241+
const slEl = document.querySelector('starlight-menu-button')
360242

361-
function closeDrawer() {
362-
drawer?.classList.remove('open')
363-
overlay?.classList.remove('open')
364-
hamburger?.setAttribute('aria-expanded', 'false')
365-
drawer?.setAttribute('aria-hidden', 'true')
366-
document.body.style.overflow = ''
243+
if (slEl) {
244+
const innerBtn = slEl.querySelector('button')
245+
const syncState = () => {
246+
const expanded = slEl.getAttribute('aria-expanded') === 'true'
247+
hamburger?.setAttribute('aria-expanded', String(expanded))
248+
}
249+
hamburger?.addEventListener('click', () => innerBtn?.click())
250+
new MutationObserver(syncState).observe(slEl, {
251+
attributes: true,
252+
attributeFilter: ['aria-expanded'],
253+
})
254+
} else if (hamburger) {
255+
hamburger.style.display = 'none'
367256
}
368257

369-
hamburger?.addEventListener('click', () => {
370-
drawer?.classList.contains('open') ? closeDrawer() : openDrawer()
371-
})
372-
373-
overlay?.addEventListener('click', closeDrawer)
374-
drawer?.querySelectorAll('a').forEach(link => link.addEventListener('click', closeDrawer))
375-
searchMobile?.addEventListener('click', () => {
376-
closeDrawer()
377-
searchDesktop?.click()
378-
})
379-
document.addEventListener('keydown', e => { if (e.key === 'Escape') closeDrawer() })
258+
searchMobile?.addEventListener('click', () => searchDesktop?.click())
380259
</script>

src/components/global/SiteFooter.astro

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ try {
112112
<h3 class="footer-col-title" style="margin-top:24px;">Explore</h3>
113113
<ul class="footer-col-links">
114114
<li><a href="/savings/">Token Savings</a></li>
115-
<li><a href="/vs/">Compare Tools</a></li>
116115
</ul>
117116
<h3 class="footer-col-title" style="margin-top:24px;">Legal</h3>
118117
<ul class="footer-col-links">
@@ -319,8 +318,6 @@ try {
319318
border-radius: 50%;
320319
flex-shrink: 0;
321320
}
322-
.footer-product-dot--vox { background: var(--violet); }
323-
.footer-product-dot--icm { background: var(--cyan); }
324321
.footer-product-dot--cloud { background: var(--accent); opacity: 0.4; }
325322

326323
.footer-badge-soon {

0 commit comments

Comments
 (0)