Skip to content

Commit 502fb65

Browse files
1chooocursoragent
andcommitted
feat(web): add /docs routes and starter MDX content
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 476100e commit 502fb65

8 files changed

Lines changed: 300 additions & 0 deletions

File tree

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import type { Metadata } from 'next'
2+
import { notFound } from 'next/navigation'
3+
import { DocsArticle } from '@/components/docs/docs-article'
4+
import {
5+
getAdjacentDocs,
6+
getDocsStaticParams,
7+
loadDoc,
8+
} from '@/lib/docs/load'
9+
import { extractToc } from '@/lib/docs/toc'
10+
import { docsMdxComponents } from '@/lib/mdx/docs-components'
11+
import { renderMdx } from '@/lib/mdx/render'
12+
13+
export function generateStaticParams() {
14+
return getDocsStaticParams()
15+
}
16+
17+
export async function generateMetadata({
18+
params,
19+
}: {
20+
params: Promise<{ slug: string[] }>
21+
}): Promise<Metadata> {
22+
const { slug: slugParts } = await params
23+
const slug = slugParts.join('/')
24+
const doc = loadDoc(slug)
25+
if (!doc) return { title: 'Not found — Tawny' }
26+
27+
return {
28+
title: `${doc.title} — Tawny`,
29+
description: doc.description,
30+
}
31+
}
32+
33+
export default async function DocsSlugPage({
34+
params,
35+
}: {
36+
params: Promise<{ slug: string[] }>
37+
}) {
38+
const { slug: slugParts } = await params
39+
const slug = slugParts.join('/')
40+
const doc = loadDoc(slug)
41+
if (!doc) notFound()
42+
43+
const { content, error } = await renderMdx(doc.body, docsMdxComponents)
44+
if (error) {
45+
console.error('Docs MDX render failed:', error)
46+
notFound()
47+
}
48+
49+
const { prev, next } = getAdjacentDocs(slug)
50+
const toc = extractToc(doc.body)
51+
52+
return (
53+
<DocsArticle
54+
breadcrumbs={[
55+
{ label: 'Docs', href: '/docs' },
56+
{ label: doc.title },
57+
]}
58+
toc={toc}
59+
content={content}
60+
prev={prev}
61+
next={next}
62+
/>
63+
)
64+
}

apps/web/app/docs/layout.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { DocsShell } from '@/components/docs/docs-shell'
2+
import { getDocsSidebar } from '@/lib/docs/load'
3+
import { getDocsSearchIndex } from '@/lib/docs/search'
4+
5+
export default function DocsLayout({ children }: { children: React.ReactNode }) {
6+
const groups = getDocsSidebar()
7+
const searchEntries = getDocsSearchIndex()
8+
9+
return (
10+
<DocsShell groups={groups} searchEntries={searchEntries}>
11+
{children}
12+
</DocsShell>
13+
)
14+
}

apps/web/app/docs/page.tsx

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import type { Metadata } from 'next'
2+
import { notFound } from 'next/navigation'
3+
import { DocsArticle } from '@/components/docs/docs-article'
4+
import { getAdjacentDocs, loadDoc } from '@/lib/docs/load'
5+
import { extractToc } from '@/lib/docs/toc'
6+
import { docsMdxComponents } from '@/lib/mdx/docs-components'
7+
import { renderMdx } from '@/lib/mdx/render'
8+
9+
export async function generateMetadata(): Promise<Metadata> {
10+
const doc = loadDoc('')
11+
if (!doc) return { title: 'Docs — Tawny' }
12+
13+
return {
14+
title: `${doc.title} — Tawny`,
15+
description: doc.description,
16+
}
17+
}
18+
19+
export default async function DocsIndexPage() {
20+
const doc = loadDoc('')
21+
if (!doc) notFound()
22+
23+
const { content, error } = await renderMdx(doc.body, docsMdxComponents)
24+
if (error) {
25+
console.error('Docs MDX render failed:', error)
26+
notFound()
27+
}
28+
29+
const { prev, next } = getAdjacentDocs('')
30+
const toc = extractToc(doc.body)
31+
32+
return (
33+
<DocsArticle
34+
breadcrumbs={[
35+
{ label: 'Docs', href: '/docs' },
36+
{ label: doc.title },
37+
]}
38+
toc={toc}
39+
content={content}
40+
prev={prev}
41+
next={next}
42+
/>
43+
)
44+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
title: Components overview
3+
description: Browse Tawny UI components and copy source from the gallery.
4+
---
5+
6+
# Components overview
7+
8+
The components gallery demos navigation patterns and motion primitives from `@tawny/ui` and the marketing site.
9+
10+
## Browse the gallery
11+
12+
Open [/components](/components) to preview live demos. Each card links to a detail page where you can copy source.
13+
14+
## What is included
15+
16+
Typical building blocks:
17+
18+
- Header / navigation demos (Tawny, Art, Dev)
19+
- Motion primitives (`BlurFade`, `BorderBeam`, `ShimmerButton`, …)
20+
- Shared utilities via `@tawny/ui`
21+
22+
```tsx
23+
import { BlurFade } from '@tawny/ui/components/blur-fade'
24+
import { NoiseTexture } from '@tawny/ui/components/noise-texture'
25+
26+
export function Example() {
27+
return (
28+
<div className="relative">
29+
<NoiseTexture opacity={0.025} />
30+
<BlurFade delay={0.05}>
31+
<h1>Hello from Tawny</h1>
32+
</BlurFade>
33+
</div>
34+
)
35+
}
36+
```
37+
38+
<Callout type="tip" title="Tip">
39+
Pair components with a full design — scaffold Art or Dev, then reuse primitives from `@tawny/ui` where it fits.
40+
</Callout>
41+
42+
## Next steps
43+
44+
- [Getting started](/docs/getting-started)
45+
- [create-tawny](/docs/create-tawny)
46+
- [Designs overview](/docs/designs/overview)
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
title: create-tawny
3+
description: Scaffold an Art or Dev project with the create-tawny CLI.
4+
---
5+
6+
# create-tawny
7+
8+
Use the CLI to generate a new Next.js app from a Tawny template.
9+
10+
## Quick start
11+
12+
```bash
13+
npx create-tawny@latest
14+
```
15+
16+
Or pick a template and project name up front:
17+
18+
```bash
19+
npx create-tawny@latest art my-site
20+
npx create-tawny@latest dev my-blog
21+
```
22+
23+
## Package managers
24+
25+
```bash
26+
pnpm create tawny@latest art my-site
27+
yarn create tawny art my-site
28+
bunx create-tawny@latest art my-site
29+
```
30+
31+
## After scaffolding
32+
33+
1. `cd` into the project directory.
34+
2. Install dependencies if the CLI did not already.
35+
3. Run the local Next.js dev server and open the app.
36+
37+
<Callout type="tip" title="Tip">
38+
Preview the same templates live on the site before you scaffold: [Art](/designs/art) and [Dev](/designs/dev).
39+
</Callout>
40+
41+
## Next steps
42+
43+
- [Designs overview](/docs/designs/overview) — what each template includes
44+
- [Components overview](/docs/components/overview) — reusable UI primitives
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
title: Designs overview
3+
description: Explore the Art and Dev design templates in Tawny.
4+
---
5+
6+
# Designs overview
7+
8+
Tawny designs are full-site templates you can preview in-product or open as edge-to-edge demos.
9+
10+
## Available designs
11+
12+
### Art
13+
14+
A bilingual bento journal with notes, projects, and location pages. Locale-aware routing (`en` / `zh`) and rich MDX shortcodes.
15+
16+
- Live showcase: [/designs/art](/designs/art)
17+
- Full preview: [/view/art](/view/art)
18+
19+
### Dev
20+
21+
A mono developer blog with projects and technical posts. English-only, terminal-inspired chrome.
22+
23+
- Live showcase: [/designs/dev](/designs/dev)
24+
- Full preview: [/view/dev](/view/dev)
25+
26+
## Showcase vs preview
27+
28+
| Path | Chrome | Use when |
29+
| --- | --- | --- |
30+
| `/designs/<id>` | Tawny navbar + product frame | Comparing templates in context |
31+
| `/view/<id>` | None | Reviewing the design as a standalone site |
32+
33+
<Callout type="note" title="Note">
34+
Scaffold either template with [create-tawny](/docs/create-tawny) — the CLI copies from the matching `templates/` package.
35+
</Callout>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
title: Getting started
3+
description: Learn how Tawny designs, components, and scaffolding fit together.
4+
---
5+
6+
# Getting started
7+
8+
Tawny is a collection of production-ready web designs and UI components for Next.js. Use the marketing site to preview, then scaffold a full project with `create-tawny`.
9+
10+
## How it fits together
11+
12+
1. **Browse** live demos under [Designs](/designs) and [Components](/components).
13+
2. **Scaffold** a project with [create-tawny](/docs/create-tawny).
14+
3. **Customize** the generated Next.js app — Tailwind v4, TypeScript, and shadcn-style primitives are already wired.
15+
16+
## What you get
17+
18+
| Surface | What it is |
19+
| --- | --- |
20+
| Designs | Full-site templates (Art, Dev) you can preview and scaffold |
21+
| Components | Navigation patterns and motion primitives with copyable source |
22+
| CLI | `create-tawny` to generate a starter from a template |
23+
24+
<Callout type="note" title="Note">
25+
Design showcases under `/designs` keep Tawny chrome. Full-site previews live under `/view` without the marketing navbar.
26+
</Callout>
27+
28+
## Next steps
29+
30+
Continue with [create-tawny](/docs/create-tawny) to scaffold your first project.

apps/web/content/docs/index.mdx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
title: Documentation
3+
description: Guides for using Tawny designs, components, and the create-tawny CLI.
4+
---
5+
6+
# Documentation
7+
8+
Welcome to the Tawny docs. These pages help you scaffold a project, explore live designs, and reuse UI building blocks.
9+
10+
## Start here
11+
12+
- [Getting started](/docs/getting-started) — how Tawny fits together
13+
- [create-tawny](/docs/create-tawny) — scaffold Art or Dev from the CLI
14+
- [Designs overview](/docs/designs/overview) — Art and Dev showcases
15+
- [Components overview](/docs/components/overview) — headers and motion primitives
16+
17+
## What you can do
18+
19+
Tawny ships handcrafted web designs and UI components you can preview on the site and scaffold into a new Next.js app.
20+
21+
<Callout type="tip" title="Tip">
22+
Prefer learning by example? Open the live [Designs](/designs) and [Components](/components) galleries alongside these docs.
23+
</Callout>

0 commit comments

Comments
 (0)