diff --git a/.claude/CLAUDE.md b/.claude/CLAUDE.md index 89d0e5c..bfadf30 100644 --- a/.claude/CLAUDE.md +++ b/.claude/CLAUDE.md @@ -8,7 +8,7 @@ A personal recipe website. Content-first, no-nonsense. The name of the third hom - **Next.js 15** with App Router, TypeScript, Tailwind CSS - **MDX** for recipe content with YAML frontmatter -- **ReactMarkdown + remark-gfm** for rendering recipe sections client-side +- **next-mdx-remote/rsc + remark-gfm** for compiling MDX content server-side - **Static site generation (SSG)** — all pages are prerendered at build time - **No database** — recipes are MDX files on disk @@ -30,13 +30,12 @@ components/ RecipesSidebar.tsx # Search + category + tag filters SelectedTags.tsx # Active tag chips TagSelector.tsx # Tag dropdown picker - RecipeCard.tsx # Recipe grid card - RecipePageClient.tsx # Recipe detail page wrapper - RecipeTabs.tsx # Section tabs (Photos/Ingredients/Instructions/Notes/References) + RecipeGridCard.tsx # Recipe grid card for listing page + RecipeCard.tsx # MDX component — splits h2 children into tab sections + RecipePageClient.tsx # Recipe detail page wrapper (server component) lib/ recipes.ts # Recipe file loader with in-memory cache; reads from public/recipes/ - parseRecipe.ts # Splits MDX content into ## sections for tabs public/ assets/ # Site-level images (homepage SVGs) diff --git a/.claude/rules/architecture.md b/.claude/rules/architecture.md index 14d6c95..c89b878 100644 --- a/.claude/rules/architecture.md +++ b/.claude/rules/architecture.md @@ -5,12 +5,12 @@ - **RecipeLayout** owns sidebar open/close state; passes `handleFilterChange` (memoised with `useCallback`) down to RecipesSidebar - **RecipesSidebar** owns filter state (search, category, selectedTags) and reports changes via `useEffect` → `onFilterChange` - **RecipesClient** owns filtered recipe list (memoised with `useMemo`) and passes `setFilters` as `onFilterChange` -- **RecipeTabs** renders content with ReactMarkdown; custom `img` component rewrites `./` paths to `/recipes/[folderPath]/` +- **RecipeCard** (MDX component) receives compiled children, splits by h2 into tab sections; custom `img` component in page.tsx rewrites `./` paths to `/recipes/[folderPath]/` ## Known Constraints - `folderPath` in recipe metadata uses backslashes on Windows (from `path.join`) — always `.replace(/\\/g, '/')` before using in URLs -- Images in recipe MDX are wrapped in `

` by ReactMarkdown — use `` not `

` to avoid invalid HTML nesting (`

` is invalid) +- Images in recipe MDX are wrapped in `

` by MDX compilation — use `` not `

` to avoid invalid HTML nesting (`

` is invalid) - `lib/recipes.ts` uses Node.js `fs` — server-side only; never import in client components -- Build warning about `` vs `` in RecipeTabs is intentional — markdown images can't use Next.js Image component +- Build warning about `` vs `` in recipe pages is intentional — markdown images can't use Next.js Image component - Never add redundant ARIA roles on semantic elements (`
`, `