refactor(docs): extract landing primitives, sections, and content#130
Merged
pratyush618 merged 6 commits intomasterfrom May 3, 2026
Merged
refactor(docs): extract landing primitives, sections, and content#130pratyush618 merged 6 commits intomasterfrom
pratyush618 merged 6 commits intomasterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cleanup pass on the docs landing page following the post-#129 conversation. The landing was a 240-LOC
page.tsxmonolith with ~30 lines of hand-rolled syntax-highlighting<span>s, five copy-pasted button styles, and panel chrome duplicated between Hero and Comparison. This PR factors it into reusable primitives + content-vs-render separation, and includes a drive-by fix for the dark-mode Shiki bg.Six commits, in dependency order — each is independently buildable.
Commits
chore(docs): add cn() utility (clsx + tailwind-merge)— installsclsx, replaces the previous one-linerexport { twMerge as cn }with the standardcn(...inputs) → twMerge(clsx(inputs))pattern. Foundation, no call sites yet.feat(docs): add highlight() helper around fumadocs-core/highlight—src/lib/highlight.tsx, async server-side Shiki via Fumadocs' built-in renderer. Centralizes theme defaults + the<pre>className override. Async server components only — runs at build time, zero client cost.feat(docs): add Button, SectionHeader, CodePanel UI primitives— three components insrc/components/ui/plus anindex.tsbarrel:Button— variants (primary/secondary/ghost), branches onhrefto render<Link>vs<button>. Replaces 5 hand-styled<Link>s across Hero + CTA.SectionHeader—title+ optionaldescription, configurable alignment. Replaces 4 copy-pasted h2 + sub-copy blocks.CodePanel— generic chrome withtone(border-top accent), accepts eitherlabel/captionprops or a customheaderslot. Used by both Hero (window-dots header) and Comparison (label/caption header).feat(docs): extract landing copy into lib/landing-content.tsx— typed constants forHERO,FEATURES,COMPARISON,CTA. Anyone editing copy now touches one file, never JSX. All strings are existing copy verbatim.refactor(docs): split landing into _sections/ and use shared primitives— splitspage.tsxintoapp/(home)/_sections/{hero,features,comparison-section,cta}.tsx(the_prefix excludes the folder from Next.js routing).page.tsxcollapses from 240 LOC to 12 LOC. The standalonecomparison.tsxis deleted; its content moves intocomparison-section.tsxusing the newCodePanelprimitive. Index barrels at_sections/index.tsandcomponents/ui/index.tskeep imports flat (import { Button, CodePanel } from "@/components/ui").fix(docs): make Shiki dual-theme bg dark-mode aware— bug fix that surfaced when the side-by-side Comparison shipped in docs: redesign landing comparison as side-by-side + table #129. Shiki's dual-theme mode emits inlinestyle="background-color:#fff"(light) plus--shiki-dark-bgas a CSS variable. WithoutdefaultColor: false, the inline white bg always wins — code blocks rendered with white bg in dark mode. PassdefaultColor: falseso Shiki emits CSS variables only; switch the<pre>background tobg-(--shiki-light-bg) dark:bg-(--shiki-dark-bg)(Fumadocs ships these utilities). Both themes now show the proper code-block bg.Net diff
page.tsxLOC<span>syntax-highlight LOChighlight())<Button variant=…>)<SectionHeader>)landing-content.tsx)Test plan
pnpm --dir docs types:check— cleanpnpm --dir docs lint— clean (2 known scaffold-CSS!importantwarnings unchanged)pnpm --dir docs build— clean static export, same route countDeploy Docsjob on this PRNon-goals
features//providers//hooks//(routes)/folders — those serve a CMS-style portfolio, not a static docs site.class-variance-authority— three variants don't justify it; plain tone maps are clearer at this scale.app/docs/,app/api/,app/llms*,app/og/, MDX components, or Fumadocs config.