Skip to content

Commit e6909ef

Browse files
jackwildmanclaude
andauthored
Fix docs site mobile layout with collapsible navigation (#127)
- Add hamburger menu button in top bar for mobile - Show everyrow branding and "by futuresearch" in mobile top bar - Navigation menu appears below top bar when opened (no slide animation) - Hide sidebar logo on mobile since branding is in top bar - Ensure consistent styling for futuresearch link across views Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 3fe3cf1 commit e6909ef

File tree

3 files changed

+134
-8
lines changed

3 files changed

+134
-8
lines changed

docs-site/src/app/globals.css

Lines changed: 85 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -655,18 +655,99 @@ noscript + .installation-tabs .tab-content:first-child {
655655
to { opacity: 1; }
656656
}
657657

658+
/* Mobile elements - hidden on desktop */
659+
.docs-mobile-menu-btn,
660+
.docs-mobile-header {
661+
display: none;
662+
}
663+
658664
/* Mobile responsive */
659665
@media (max-width: 768px) {
660-
.docs-layout {
666+
/* Hide desktop elements on mobile */
667+
.docs-top-bar > .docs-futuresearch-link {
668+
display: none;
669+
}
670+
671+
/* Mobile header in top bar */
672+
.docs-mobile-header {
673+
display: flex;
674+
align-items: flex-start;
675+
justify-content: space-between;
676+
width: 100%;
677+
}
678+
679+
.docs-mobile-brand {
680+
display: flex;
661681
flex-direction: column;
682+
gap: 0.125rem;
683+
}
684+
685+
.docs-mobile-logo-text {
686+
font-family: var(--font-jetbrains), "JetBrains Mono", ui-monospace, monospace;
687+
font-size: 1.125rem;
688+
font-weight: 500;
689+
color: var(--brand-primary);
690+
text-decoration: none;
691+
}
692+
693+
.docs-mobile-logo-text:hover {
694+
text-decoration: none;
695+
opacity: 0.8;
696+
}
697+
698+
.docs-mobile-futuresearch-link {
699+
font-family: var(--font-jetbrains), "JetBrains Mono", ui-monospace, monospace;
700+
font-size: 0.75rem;
701+
font-weight: 300;
702+
color: var(--brand-primary);
703+
letter-spacing: 0.02em;
704+
text-decoration: none;
705+
}
706+
707+
.docs-mobile-futuresearch-link .highlight {
708+
color: var(--brand-accent);
709+
font-weight: 400;
710+
}
711+
712+
.docs-mobile-menu-btn {
713+
display: flex;
714+
align-items: center;
715+
justify-content: center;
716+
background: none;
717+
border: none;
718+
padding: 0.5rem;
719+
cursor: pointer;
720+
color: var(--text-primary);
721+
border-radius: 0.375rem;
722+
}
723+
724+
/* Ensure top bar has consistent height on mobile */
725+
.docs-top-bar {
726+
min-height: 3.5rem;
662727
}
663728

729+
/* Mobile sidebar - appears below top bar */
664730
.docs-sidebar {
731+
display: none;
732+
position: fixed;
733+
top: 3.5rem;
734+
left: 0;
665735
width: 100%;
666-
height: auto;
667-
position: relative;
736+
height: calc(100vh - 3.5rem);
737+
z-index: 50;
738+
background: var(--background);
668739
border-right: none;
669-
border-bottom: 1px solid var(--border);
740+
border-top: 1px solid var(--border);
741+
overflow-y: auto;
742+
}
743+
744+
.docs-sidebar.docs-sidebar-open {
745+
display: block;
746+
}
747+
748+
/* Hide logo in sidebar on mobile since it's in top bar */
749+
.docs-sidebar .docs-sidebar-logo {
750+
display: none;
670751
}
671752

672753
.docs-content-inner {

docs-site/src/components/DocsLayout.tsx

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
"use client";
2+
3+
import { useState } from "react";
14
import { Sidebar } from "./Sidebar";
25
import { CodeBlockEnhancer } from "./CodeBlockEnhancer";
36
import type { NavSection } from "@/utils/docs";
@@ -8,11 +11,50 @@ interface DocsLayoutProps {
811
}
912

1013
export function DocsLayout({ navigation, children }: DocsLayoutProps) {
14+
const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
15+
1116
return (
1217
<div className="docs-layout">
13-
<Sidebar navigation={navigation} />
18+
<Sidebar
19+
navigation={navigation}
20+
isOpen={mobileMenuOpen}
21+
onClose={() => setMobileMenuOpen(false)}
22+
/>
1423
<main className="docs-content">
1524
<div className="docs-top-bar">
25+
<div className="docs-mobile-header">
26+
<div className="docs-mobile-brand">
27+
<a href="https://everyrow.io" className="docs-mobile-logo-text">everyrow</a>
28+
<a
29+
href="https://futuresearch.ai"
30+
target="_blank"
31+
rel="noopener noreferrer"
32+
className="docs-mobile-futuresearch-link"
33+
>
34+
by futu<span className="highlight">re</span>search
35+
</a>
36+
</div>
37+
<button
38+
className="docs-mobile-menu-btn"
39+
onClick={() => setMobileMenuOpen(!mobileMenuOpen)}
40+
aria-label="Toggle navigation menu"
41+
>
42+
<svg
43+
width="24"
44+
height="24"
45+
viewBox="0 0 24 24"
46+
fill="none"
47+
stroke="currentColor"
48+
strokeWidth="2"
49+
strokeLinecap="round"
50+
strokeLinejoin="round"
51+
>
52+
<line x1="3" y1="6" x2="21" y2="6" />
53+
<line x1="3" y1="12" x2="21" y2="12" />
54+
<line x1="3" y1="18" x2="21" y2="18" />
55+
</svg>
56+
</button>
57+
</div>
1658
<a
1759
href="https://futuresearch.ai"
1860
target="_blank"

docs-site/src/components/Sidebar.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,22 @@ import type { NavSection } from "@/utils/docs";
66

77
interface SidebarProps {
88
navigation: NavSection[];
9+
isOpen?: boolean;
10+
onClose?: () => void;
911
}
1012

11-
export function Sidebar({ navigation }: SidebarProps) {
13+
export function Sidebar({ navigation, isOpen, onClose }: SidebarProps) {
1214
const pathname = usePathname();
1315

1416
// Remove leading/trailing slashes for comparison
1517
// Note: usePathname() returns path without basePath, so no need to strip /docs
1618
const currentSlug = pathname.replace(/^\//, "").replace(/\/$/, "");
1719

1820
return (
19-
<aside className="docs-sidebar">
21+
<aside className={`docs-sidebar ${isOpen ? "docs-sidebar-open" : ""}`}>
2022
<div className="docs-sidebar-logo">
2123
<a href="https://everyrow.io" className="docs-sidebar-logo-text">everyrow</a>
22-
<Link href="/" className="docs-sidebar-logo-chip">docs</Link>
24+
<Link href="/" className="docs-sidebar-logo-chip" onClick={onClose}>docs</Link>
2325
</div>
2426

2527
{navigation.map((section) => (
@@ -33,6 +35,7 @@ export function Sidebar({ navigation }: SidebarProps) {
3335
<Link
3436
href={`/${item.slug}`}
3537
className={isActive ? "active" : ""}
38+
onClick={onClose}
3639
>
3740
{item.title}
3841
</Link>

0 commit comments

Comments
 (0)