Skip to content

Commit aed4b08

Browse files
author
abrulic
committed
updated sidebar
1 parent b54efd6 commit aed4b08

File tree

6 files changed

+188
-13
lines changed

6 files changed

+188
-13
lines changed

app/components/sidebar/mobile-sidebar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ const MobileSidebarCloseButton = () => {
6464
<button
6565
type="button"
6666
onClick={close}
67-
className="absolute top-2 right-3 z-10 rounded-full p-2 text-[var(--color-text-normal)] transition-colors duration-200 hover:text-[var(--color-text-hover)]"
67+
className="absolute top-1 right-1 z-10 rounded-full p-2 text-[var(--color-text-normal)] transition-colors duration-200 hover:text-[var(--color-text-hover)]"
6868
aria-label="Close navigation menu"
6969
>
7070
<Icon name="X" className="size-5" />

app/components/sidebar/sidebar-content.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ export const SidebarContent = ({
1818
const version = useCurrentVersion()
1919
return (
2020
<nav
21-
className="max-h-[calc(100vh-var(--header-height))] min-h-0 flex-1 overflow-y-auto pr-4"
21+
className="flex max-h-[calc(100vh-var(--header-height))] min-h-0 flex-col overflow-y-auto pr-4"
2222
aria-label="Documentation navigation"
2323
>
2424
{documentationPages.length > 0 && (
25-
<div className="mb-6 space-y-1">
25+
<div className="my-3">
2626
{documentationPages.map((p) => (
2727
<DocumentationNavLink
2828
key={p.slug}

app/components/sidebar/sidebar-items.tsx

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,18 @@ type DocumentationNavLinkProps = {
1414
to: string
1515
depth?: number
1616
onClick?: () => void
17+
className?: string
1718
}
1819

19-
export function DocumentationNavLink({ title, to, depth = 0, onClick }: DocumentationNavLinkProps) {
20+
export function DocumentationNavLink({ title, to, depth = 0, onClick, className }: DocumentationNavLinkProps) {
2021
const indentClass = getIndentClass(depth)
2122
return (
2223
<NavLink
2324
prefetch="intent"
2425
to={to}
2526
onClick={onClick}
2627
className={({ isActive, isPending }) =>
27-
`block rounded-md px-3 py-1 text-sm md:text-base ${indentClass}
28+
`block rounded-md px-3 py-0.5 text-sm md:text-base ${indentClass} ${className}
2829
${isPending ? "text-[var(--color-text-hover)]" : ""}
2930
${
3031
isActive
@@ -42,39 +43,47 @@ interface SectionItemProps {
4243
item: SidebarSection
4344
depth?: number
4445
onItemClick?: () => void
46+
className?: string
4547
}
4648

4749
const SectionTitle = ({ title }: { title: string }) => {
4850
return (
49-
<h3 className="mb-3 ml-4 px-3 font-semibold text-[var(--color-text-active)] text-sm uppercase tracking-wide md:text-base">
51+
<h3 className="my-2 ml-4 px-3 font-semibold text-[var(--color-text-active)] text-sm uppercase tracking-wide md:text-base">
5052
{title}
5153
</h3>
5254
)
5355
}
5456

55-
export const SectionItem = ({ item, depth = 0, onItemClick }: SectionItemProps) => {
57+
export const SectionItem = ({ item, depth = 0, onItemClick, className = "my-1" }: SectionItemProps) => {
5658
const isTopLevel = depth === 0
5759
const version = useCurrentVersion()
5860
const content = (
5961
<div>
6062
{item.documentationPages.length > 0 && (
61-
<div className="mb-4 space-y-1">
63+
<div className="flex flex-col">
6264
{item.documentationPages.map((doc) => (
6365
<DocumentationNavLink
6466
key={doc.slug}
6567
title={doc.title}
6668
depth={depth}
6769
onClick={onItemClick}
6870
to={buildSectionedTo(version, doc.slug)}
71+
className={className}
6972
/>
7073
))}
7174
</div>
7275
)}
7376

7477
{item.subsections.length > 0 && (
75-
<div className="space-y-4">
78+
<div>
7679
{item.subsections.map((subsection) => (
77-
<SectionItem key={subsection.slug} item={subsection} depth={depth + 1} onItemClick={onItemClick} />
80+
<SectionItem
81+
key={subsection.slug}
82+
item={subsection}
83+
depth={depth + 1}
84+
onItemClick={onItemClick}
85+
className={className}
86+
/>
7887
))}
7988
</div>
8089
)}
@@ -86,15 +95,15 @@ export const SectionItem = ({ item, depth = 0, onItemClick }: SectionItemProps)
8695
<AccordionItem
8796
title={item.title}
8897
titleElement="h5"
89-
titleClassName=" font-semibold tracking-wide text-[var(--color-text-active)]"
98+
titleClassName="font-semibold tracking-wide text-[var(--color-text-active)]"
9099
content={content}
91100
defaultOpen={true}
92101
/>
93102
)
94103
}
95104

96105
return (
97-
<div className="mb-6">
106+
<div className="my-2 flex flex-col">
98107
<SectionTitle title={item.title} />
99108
{content}
100109
</div>

app/ui/accordion.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export const AccordionItem = ({
6666
const [isOpen, setIsOpen] = useState(defaultOpen)
6767

6868
const buttonClasses =
69-
"flex gap-2 items-center w-full p-2 transition-transform duration-200 text-[var(--color-text-normal)] hover:text-[var(--color-text-hover)] hover:cursor-pointer rounded-md"
69+
"flex gap-2 items-center w-full px-2 transition-transform duration-200 text-[var(--color-text-normal)] hover:text-[var(--color-text-hover)] hover:cursor-pointer rounded-md"
7070

7171
const iconClasses = "w-4 h-4 transition-transform duration-300"
7272

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
---
2+
title: "Project Structure"
3+
summary: "Understanding the template organization"
4+
description: "Learn about the folder structure and key files in the documentation template."
5+
---
6+
7+
## Folder Overview
8+
9+
```
10+
docs/
11+
├── .content-collections/ # Auto-generated (dev mode)
12+
├── .github/ # GitHub Actions workflows
13+
├── app/ # React Router application
14+
│ ├── components/ # UI components
15+
│ ├── hooks/ # React hooks
16+
│ ├── routes/ # Route definitions
17+
│ ├── utils/ # Utility functions
18+
│ ├── routes.ts # Route configuration
19+
│ └── tailwind.css # Tailwind styles
20+
├── content/ # Your documentation (MDX/MD)
21+
├── generated-docs/ # Generated docs (production)
22+
├── public/ # Static assets
23+
├── resources/ # Icons, fonts, assets
24+
├── content-collections.ts # Content config
25+
├── generate-docs.ts # Docs generation script
26+
├── Dockerfile # Docker configuration
27+
├── fly.toml # Fly.io deployment config
28+
├── .env.example # Environment variables template
29+
└── package.json # Dependencies and scripts
30+
```
31+
32+
## Core Folders
33+
34+
### `app/`
35+
36+
The React Router v7 application that powers your documentation site.
37+
38+
**Key folders:**
39+
- **`components/`** - Reusable UI components (Command K, Code blocks, Sidebar, MDXWrapper, etc.)
40+
- **`hooks/`** - Custom React hooks for documentation features
41+
- **`routes/`** - Route components (homepage, documentation layout, documentation pages)
42+
- **`utils/`** - Helper functions and utilities
43+
- **`tailwind.css`** - Global styles and Tailwind configuration
44+
45+
### `resources/`
46+
47+
Static resources used throughout the site:
48+
- SVG icons
49+
- Custom fonts
50+
- Other design assets
51+
52+
Feel free to add your own assets here.
53+
54+
### `content/`
55+
56+
**This is where your documentation lives.** All `.md` and `.mdx` files should be placed here following the content organization structure (see Content Guide).
57+
58+
### `generated-docs/`
59+
60+
**Production-only folder.** Contains processed documentation organized by version:
61+
- `main/` - Latest docs from main branch (no tags)
62+
- `v1.0.0/`, `v2.0.0/` - Versioned documentation
63+
64+
This folder is created by the `generate-docs.ts` script and used during production builds.
65+
66+
### `.content-collections/`
67+
68+
**Development-only folder (auto-generated).** Contains processed content for hot reloading. Don't edit this folder manually—it's regenerated automatically.
69+
70+
## Key Files
71+
72+
### `package.json`
73+
74+
Contains important scripts:
75+
76+
```json
77+
{
78+
"scripts": {
79+
...
80+
"generate:docs": "tsx generate-docs.ts",
81+
"content-collections:build": "content-collections build"
82+
}
83+
}
84+
```
85+
86+
### `content-collections.ts`
87+
88+
Configures how MDX/MD files are processed. Defines:
89+
- Document schema (frontmatter fields)
90+
- File patterns to match
91+
- Content transformations
92+
93+
### `generate-docs.ts`
94+
95+
Script that generates versioned documentation from your git releases. Uses:
96+
- Git commands to fetch releases/tags
97+
- Processes and organizes docs by version
98+
99+
### `fly.toml`
100+
101+
Fly.io deployment configuration. Defines:
102+
- App name
103+
- Region
104+
- Build settings
105+
- Health checks
106+
- Environment variables
107+
108+
### `Dockerfile`
109+
110+
Docker configuration for building and running the app in production.
111+
112+
### `.env.example`
113+
114+
Template for environment variables:
115+
116+
```env
117+
GITHUB_REPO_URL=https://github.com/your-org/your-repo
118+
```
119+
120+
Copy this to `.env` and fill in your values.
121+
122+
### `routes.ts`
123+
124+
React Router configuration file that defines:
125+
- Route patterns
126+
- Layout hierarchy
127+
- Route metadata
128+
129+
## Components You'll Use
130+
131+
### `MDXWrapper`
132+
133+
Wraps your MDX content with styling. Located in `app/components/`.
134+
135+
### Custom MDX Components
136+
137+
Pre-built components you can use in your MDX:
138+
- `<InfoAlert>` - Information callouts
139+
- `<WarningAlert>` - Warning messages
140+
141+
To use custom components in MDX, pass them to the `components` prop in `MDXContent`.
142+
143+
### Command K
144+
145+
Built-in search component that indexes your documentation automatically.
146+
147+
### Sidebar
148+
149+
Auto-generated from your content structure. Respects the ordering prefixes in your filenames.
150+
151+
## Customization Points
152+
153+
All FIXME comments mark places you'll want to customize:
154+
- Brand colors in `tailwind.css`
155+
- Package name references
156+
- GitHub repository links
157+
- Site metadata
158+
159+
Find them with:
160+
161+
```bash
162+
grep -r "FIXME" --include="*.ts" --include="*.tsx" --include="*.css"
163+
```
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
title: "Subsection"
3+
---

0 commit comments

Comments
 (0)