Skip to content

Commit 0ea6899

Browse files
committed
chore: add CLAUDE.md with project context for AI sessions
1 parent 071db60 commit 0ea6899

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

CLAUDE.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# styled-components Documentation Website
2+
3+
## Build & Test
4+
- `yarn` to install (Yarn PnP, no package-lock.json)
5+
- `npx next build` to verify — all pages are statically generated
6+
- `npx jest -c .jest.config.js` to run tests
7+
- `npx jest -c .jest.config.js --updateSnapshot` after font/style changes
8+
- Pre-commit hooks run jest on related files + prettier via lint-staged
9+
10+
## Documentation Structure
11+
- MDX content lives in `sections/{category}/{topic}.mdx`
12+
- Each docs page is wired in 3 places: the MDX file, `app/docs/{category}/page.tsx` (import + render), and `app/docs.json` (nav sidebar)
13+
- Live code examples use ```react blocks (not ```tsx). They have `React`, `styled`, `css`, `keyframes`, `ThemeProvider`, and `render()` in scope. Use `React.useRef()` not `useRef()`.
14+
- The `components` import path alias `@/` maps to project root
15+
16+
## Key Architecture
17+
- `lib/registry.tsx` — SSR style registry wrapping root layout. Still needed despite v6.3.0+ RSC support because most components are `'use client'`
18+
- `utils/fonts.ts` — font family constants using CSS variables `--font-body` and `--font-mono` set via next/font in root layout
19+
- `components/Anchor.tsx` — renders section headings with anchor links, used across all doc pages
20+
- Releases page (`app/releases/page.tsx`) fetches from GitHub API and renders with `markdown-to-jsx`
21+
22+
## Gotchas
23+
- Removing the SSR registry causes FOUC — the site has heavy `'use client'` usage
24+
- `app/docs.json` section titles must exactly match the `##` heading in the MDX file (used for anchor link generation)
25+
- Snapshot tests include rendered CSS — any font, style constant, or styled-components version change requires snapshot updates

0 commit comments

Comments
 (0)