Production-ready animations, transitions, backgrounds, and scenes for Remotion
TypeScript ai-agentsclaude-codedemo-videomcpmcp-servermodel-context-protocolmotion-designproduct-demoreactremotionshadcnvideo
feat: added docs header
dev_wandry91ca998e7ff4
diff --git a/app/(home)/components/site-header.tsx b/app/(home)/components/site-header.tsxindex a9b0ffc8..940f414b 100644--- a/app/(home)/components/site-header.tsx+++ b/app/(home)/components/site-header.tsx@@ -63,9 +63,26 @@ function GitHubStars({export function SiteHeader({navLinks,githubStars = null,+ sticky = true,+ fluid = false,}: {navLinks: NavLink[];githubStars?: number | null;+ /**+ * Landing variant (default) is sticky and collapses into a floating pill on+ * scroll. Docs passes `sticky={false}` for a static, full-width bar with no+ * scroll listener and no pill morph.+ */+ sticky?: boolean;+ /**+ * Contained (default) keeps the inner bar centered at `max-w-6xl` to match+ * the landing content column. `fluid` drops the max-width so the bar spans+ * the full viewport — used in docs so the logo aligns to the left edge of the+ * full-bleed sidebar instead of floating inward. Intended for the static+ * (`sticky={false}`) docs variant; the sticky pill relies on the contained+ * width, so don't combine `fluid` with the sticky landing variant.+ */+ fluid?: boolean;}) {const [open, setOpen] = useState(false);const [scrolled, setScrolled] = useState(false);@@ -77,30 +94,51 @@ export function SiteHeader({});// Collapse the full-width bar into a floating, container-width pill on scroll.+ // Only the sticky (landing) variant listens to scroll; the static docs+ // variant never morphs, so the listener is not attached there.useEffect(() => {+ if (!sticky) return;const onScroll = () => setScrolled(window.scrollY > 8);onScroll();window.addEventListener("scroll", onScroll, { passive: true });return () => window.removeEventListener("scroll", onScroll);- }, []);+ }, [sticky]);++ // `scrolled` can only be true in the sticky variant; guard so the static+ // path never picks up the pill classes even if state lingers.+ const isPill = sticky && scrolled;return (<headerclassName={cn(- "sticky inset-x-0 top-0 z-40 transition-[background-color,border-color,padding] duration-300",- scrolled- ? "border-transparent bg-transparent py-3"- : "border-border bg-background/70 backdrop-blur-xl",+ "z-40",+ sticky+ ? cn(+ "sticky inset-x-0 top-0 transition-[background-color,border-color,padding] duration-300",+ isPill+ ? "border-transparent bg-transparent py-3"+ : "border-border bg-background/70 backdrop-blur-xl",+ )+ : "relative h-16 w-full border-b border-border bg-background/70 backdrop-blur-xl",)}>{/* Inner bar matches the page content width (same utilities as SECTION),- so when scrolled it becomes a floating pill exactly that width. */}+ so when scrolled it becomes a floating pill exactly that width.+ In the static docs variant it stays a fixed-height, borderless bar.+ `fluid` drops the max-width/centering so the bar spans the full+ viewport and the logo lands at the sidebar's left edge. */}<divclassName={cn(- "mx-auto flex w-full max-w-6xl items-center justify-between border px-4 transition-all duration-300 sm:px-6",- scrolled- ? "h-14 rounded-2xl border-border bg-background/80 shadow-lg shadow-black/5 backdrop-blur-xl dark:shadow-black/30"- : "h-16 border-transparent",+ "flex w-full items-center justify-between px-4 sm:px-6",+ fluid ? "" : "mx-auto max-w-6xl",+ sticky+ ? cn(+ "border transition-all duration-300",+ isPill+ ? "h-14 rounded-2xl border-border bg-background/80 shadow-lg shadow-black/5 backdrop-blur-xl dark:shadow-black/30"+ : "h-16 border-transparent",+ )+ : "h-16",)}><Linkdiff --git a/app/docs/[[...slug]]/page.tsx b/app/docs/[[...slug]]/page.tsxindex 7925adf2..46f606e9 100644--- a/app/docs/[[...slug]]/page.tsx+++ b/app/docs/[[...slug]]/page.tsx@@ -32,13 +32,16 @@ export default async function Page(props: {path: `content/docs/${(params.slug ?? []).join("/") || "index"}.mdx`,}}>- <DocsTitle className="text-5xl font-bold tracking-tighter md:text-6xl lg:text-7xl">+ <DocsTitle+ style={{ fontFamily: "var(--font-display)" }}+ className="text-4xl font-semibold tracking-tight text-balance md:text-5xl lg:text-6xl"+ >{data.title}</DocsTitle>- <DocsDescription className="mt-0 max-w-3xl text-balance text-lg text-muted-foreground md:text-xl">+ <DocsDescription className="mt-3 mb-0 max-w-3xl text-balance text-lg text-muted-foreground md:text-xl">{data.description}</DocsDescription>- <DocsBody>+ <DocsBody className="mt-8"><MDX components={getMDXComponents()} /></DocsBody></DocsPage>diff --git a/app/docs/layout.tsx b/app/docs/layout.tsxindex bcd5ad21..fb52328b 100644--- a/app/docs/layout.tsx+++ b/app/docs/layout.tsx@@ -1,26 +1,47 @@import { DocsLayout } from "fumadocs-ui/layouts/docs";import type { ReactNode } from "react";+import { DOCS_NAV } from "@/config/landing";+import { SiteHeader } from "@/app/(home)/components/site-header";+import { getGitHubStars } from "@/lib/github";import { baseOptions } from "@/lib/layout.shared";import { source } from "@/source";-export default function Layout({ children }: { children: ReactNode }) {+export default async function Layout({ children }: { children: ReactNode }) {+ const githubStars = await getGitHubStars();+return (- <DocsLayout- tree={source.pageTree}- {...baseOptions()}- searchToggle={{ enabled: false }}- >- {/* `relative isolate` scopes the decorative grid to the content column so- it sits behind the page body but above the base background — the same- dotted-grid backdrop used behind the landing hero, for visual- continuity when crossing from the landing into the docs. */}- <div className="relative isolate">- <div- aria-hidden- className="pointer-events-none absolute inset-x-0 top-0 -z-10 h-[360px] bg-grid-fade"- />- {children}- </div>- </DocsLayout>+ <>+ {/* Custom remocn chrome owns the only top nav. Static (non-sticky) in+ docs and `fluid` (full-width) so the logo aligns to the left edge of+ the sidebar instead of floating inward at the contained width. */}+ <SiteHeader+ sticky={false}+ fluid+ navLinks={DOCS_NAV}+ githubStars={githubStars}+ />+ <DocsLayout+ tree={source.pageTree}+ {...baseOptions()}+ // Suppress the Fumadocs default top nav so there is no double header —+ // `SiteHeader` above is the single top bar. Verified against+ // fumadocs-ui 16.7 `NavOptions.enabled` (layouts/shared) and the+ // `navEnabled && jsx(slots.header)` guard in layouts/docs/client.+ nav={{ enabled: false }}+ searchToggle={{ enabled: false }}+ >+ {/* `relative isolate` scopes the decorative grid to the content column so+ it sits behind the page body but above the base background — the same+ dotted-grid backdrop used behind the landing hero, for visual+ continuity when crossing from the landing into the docs. */}+ <div className="relative isolate">+ <div+ aria-hidden+ className="pointer-events-none absolute inset-x-0 top-0 -z-10 h-[360px] bg-grid-fade"+ />+ {children}+ </div>+ </DocsLayout>+ </>);}diff --git a/app/globals.css b/app/globals.cssindex b94f7543..1e84af0f 100644--- a/app/globals.css+++ b/app/globals.css@@ -183,18 +183,38 @@backdrop-filter: blur(12px);}-/* Match fumadocs MDX code blocks (```tsx ... ```) to the CodeBlockCommand look */+/* ── Code / Shiki surfaces (F3) ──────────────────────────────────────+ MDX code blocks (```tsx … ```) resolve to the `muted` token, matching+ the CodeBlockCommand look. No hardcoded editor hex, no border, no+ ambient shadow — the slab reads as a calm surface in both themes. */.prose figure.shiki {background-color: var(--muted) !important;border-width: 0 !important;box-shadow: none !important;+ border-radius: var(--radius-xl);}.prose figure.shiki pre,.prose figure.shiki [class*="bg-"] {background-color: transparent !important;}+/* Inline `code` inside prose — token-driven chip, not a default slab. */+.prose :not(pre) > code {+ background-color: color-mix(in oklab, var(--muted) 70%, transparent);+ border: 1px solid var(--border);+ border-radius: var(--radius-sm);+ padding: 0.125rem 0.375rem;+ font-size: 0.875em;+ font-weight: 500;+}+.prose :not(pre) > code::before,+.prose :not(pre) > code::after {+ content: none;+}-/* Docs prose vertical rhythm — explicit so headings group with following content */+/* ── Docs prose (C2/C3/A3) ───────────────────────────────────────────+ Explicit heading rhythm so a heading groups with the content beneath+ it. h2–h4 stay in the sans/heading scale; only the doc-title H1 gets+ the reserved display treatment. */.prose h2 {@apply mt-16 mb-4 text-3xl font-semibold tracking-tight;}@@ -209,18 +229,142 @@@apply mt-8 mb-2 text-base font-semibold tracking-tight;}-/* Reading paragraphs cap — keep prose readable while interactive blocks stay wide */+/* Links (B4): foreground-weighted, underline reveals on hover via the+ token border — accent color only on hover, never default-blue. */+.prose a {+ color: var(--foreground);+ font-weight: 500;+ text-decoration: none;+ text-underline-offset: 0.2em;+ text-decoration-color: color-mix(in oklab, var(--foreground) 35%, transparent);+ transition: text-decoration-color 150ms ease, color 150ms ease;+}+.prose a:hover {+ text-decoration: underline;+ text-decoration-color: color-mix(in oklab, var(--foreground) 60%, transparent);+}+.prose a:focus-visible {+ outline: none;+ border-radius: var(--radius-sm);+ box-shadow: 0 0 0 2px color-mix(in oklab, var(--ring) 60%, transparent);+}++/* Tables — token hairlines, muted header row, no zebra slop. */+.prose table {+ font-size: 0.875rem;+}+.prose thead {+ border-bottom: 1px solid var(--border);+}+.prose th {+ font-weight: 600;+ color: var(--foreground);+}+.prose tbody tr {+ border-bottom: 1px solid var(--border);+}+.prose td,+.prose th {+ padding: 0.5rem 0.75rem;+}++/* Reading measure (A2/C4): cap prose text at ~68ch while interactive+ `.not-prose` blocks (preview stage, install, props table) stay full+ content width — never clamp the centerpieces. */.prose p,.prose ul,-.prose ol {+.prose ol,+.prose blockquote {@apply max-w-3xl;}+.prose .not-prose,+.prose .not-prose p,+.prose .not-prose ul,+.prose .not-prose ol {+ max-width: none;+}-/* Sidebar tightening — fumadocs sidebar typography */-#nd-sidebar a {+/* Blockquote — soft left hairline, not a heavy bar. */+.prose blockquote {+ border-inline-start: 2px solid var(--border);+ color: var(--muted-foreground);+ font-style: normal;+}++/* ── Sidebar de-template (E2/E3/E6) ──────────────────────────────────+ Override Fumadocs' default sidebar look via #nd-sidebar selectors.+ We do NOT override fd-* tokens with literal colors — these rules+ restyle layout/behaviour and resolve color through our oklch tokens.+ Applies to both the desktop rail and the mobile drawer (#nd-sidebar+ plus the drawer's sidebar root). */+#nd-sidebar a,+#nd-sidebar-mobile a {font-size: 0.8125rem;letter-spacing: -0.01em;}-#nd-sidebar [data-active="true"] {++/* Category section headers (SidebarSeparator) — small uppercase muted+ labels. The Separator renders as a bare <p> inside the page-tree, so+ scoping to #nd-sidebar p reliably targets the section labels without+ touching the nav links (which are <a>). */+#nd-sidebar p,+#nd-sidebar-mobile p {+ text-transform: uppercase;+ letter-spacing: 0.08em;+ font-size: 0.6875rem;+ font-weight: 600;+ color: var(--muted-foreground);+}++/* Nav items: comfortable-compact rows (~34px), muted resting state.+ Hover is a COLOR transition only — no background slab grow, no+ underline animation (E6). We neutralise Fumadocs' hover:bg-*. */+#nd-sidebar a[data-active],+#nd-sidebar-mobile a[data-active] {+ padding-block: 0.375rem;+ color: var(--muted-foreground);+ transition: color 150ms ease;+}+#nd-sidebar a[data-active]:hover,+#nd-sidebar-mobile a[data-active]:hover {+ color: var(--foreground);+ background-color: transparent;+}++/* Active item (E3): not color-only. Subtle accent fill + a left hairline+ indicator drawn from the foreground token + medium weight. */+#nd-sidebar a[data-active="true"],+#nd-sidebar-mobile a[data-active="true"] {+ position: relative;font-weight: 500;+ color: var(--foreground);+ background-color: color-mix(in oklab, var(--accent) 80%, transparent);+}+#nd-sidebar a[data-active="true"]:hover,+#nd-sidebar-mobile a[data-active="true"]:hover {+ background-color: color-mix(in oklab, var(--accent) 80%, transparent);+}+#nd-sidebar a[data-active="true"]::before,+#nd-sidebar-mobile a[data-active="true"]::before {+ content: "";+ position: absolute;+ inset-inline-start: 0;+ inset-block: 0.3rem;+ width: 2px;+ border-radius: 1px;+ background-color: var(--foreground);+}++@media (prefers-reduced-motion: reduce) {+ #nd-sidebar a[data-active],+ #nd-sidebar-mobile a[data-active] {+ transition: none;+ }+}++/* ── Default-Fumadocs visual tells, neutralised ──────────────────────+ Anything that could leak a stock accent / off-token colour is pinned+ back to our oklch tokens via the fd-* bridge (no literal overrides). */+#nd-sidebar [data-active="true"] svg {+ color: var(--foreground);}diff --git a/components/docs/component-preview.tsx b/components/docs/component-preview.tsxindex 3d48b4d2..1ef6506a 100644--- a/components/docs/component-preview.tsx+++ b/components/docs/component-preview.tsx@@ -2,7 +2,7 @@import { Player } from "@remotion/player";import { DynamicCodeBlock } from "fumadocs-ui/components/dynamic-codeblock";-import { CheckIcon, LinkIcon, RotateCcwIcon } from "lucide-react";+import { CheckIcon, LinkIcon, PlayIcon, RotateCcwIcon } from "lucide-react";import {parseAsBoolean,parseAsFloat,@@ -150,25 +150,16 @@ function Preview({</TabsList><TabsContent value="preview" className="mt-0">- <div className="surface-card aspect-video w-full overflow-hidden rounded-2xl">- <Player- component={Component}- inputProps={values}- durationInFrames={config.durationInFrames}- fps={config.fps}- compositionWidth={config.compositionWidth}- compositionHeight={config.compositionHeight}- style={{ width: "100%", height: "100%" }}- controls- loop- autoPlay- acknowledgeRemotionLicense- />- </div>+ <PreviewStage+ name={name}+ Component={Component}+ inputProps={values}+ config={config}+ /></TabsContent><TabsContent value="code" className="mt-0">- <div className="surface-card overflow-hiddenrounded-2xl [&_pre]:!rounded-none [&_pre]:!border-0 [&_pre]:!bg-transparent">+ <div className="surface-card overflow-hidden rounded-2xl [&_pre]:!rounded-none [&_pre]:!border-0 [&_pre]:!bg-transparent"><DynamicCodeBlock lang="tsx" code={code} /></div></TabsContent>@@ -176,7 +167,7 @@ function Preview({<div className="overflow-hidden rounded-2xl"><div className="flex items-center justify-between pt-4 pb-2">- <h2>Customize</h2>+ <span className="text-sm font-medium text-foreground">Customize</span><div className="flex items-center gap-1"><buttontype="button"@@ -220,6 +211,102 @@ function Preview({);}+function usePrefersReducedMotion() {+ const [reduced, setReduced] = useState(false);+ useEffect(() => {+ if (typeof window === "undefined" || !window.matchMedia) return;+ const mql = window.matchMedia("(prefers-reduced-motion: reduce)");+ setReduced(mql.matches);+ const onChange = (e: MediaQueryListEvent) => setReduced(e.matches);+ mql.addEventListener("change", onChange);+ return () => mql.removeEventListener("change", onChange);+ }, []);+ return reduced;+}++/**+ * D2 — lazy-mount the Remotion player. Until the stage enters the viewport+ * (IntersectionObserver) or the user clicks the poster, render a labeled+ * poster button that exactly matches the Suspense fallback dimensions, so the+ * live Player swaps in with zero layout shift.+ */+function PreviewStage({+ name,+ Component,+ inputProps,+ config,+}: {+ name: string;+ Component: React.ComponentType<any>;+ inputProps: Record<string, unknown>;+ config: ComponentConfig;+}) {+ const [mounted, setMounted] = useState(false);+ const frameRef = useRef<HTMLDivElement>(null);+ const reducedMotion = usePrefersReducedMotion();++ useEffect(() => {+ if (mounted) return;+ const el = frameRef.current;+ if (!el || typeof IntersectionObserver === "undefined") return;+ const observer = new IntersectionObserver(+ (entries) => {+ if (entries.some((entry) => entry.isIntersecting)) {+ setMounted(true);+ observer.disconnect();+ }+ },+ { rootMargin: "200px 0px" },+ );+ observer.observe(el);+ return () => observer.disconnect();+ }, [mounted]);++ return (+ <div+ ref={frameRef}+ className="surface-card aspect-video w-full overflow-hidden rounded-2xl"+ >+ {mounted ? (+ <div+ className={cn(+ "size-full",+ !reducedMotion && "animate-in fade-in duration-300 ease-out",+ )}+ >+ <Player+ component={Component}+ inputProps={inputProps}+ durationInFrames={config.durationInFrames}+ fps={config.fps}+ compositionWidth={config.compositionWidth}+ compositionHeight={config.compositionHeight}+ style={{ width: "100%", height: "100%" }}+ controls+ loop+ autoPlay+ acknowledgeRemotionLicense+ />+ </div>+ ) : (+ <button+ type="button"+ onClick={() => setMounted(true)}+ aria-label={`Play preview of ${name}`}+ className={cn(+ "group flex size-full items-center justify-center bg-muted/40 transition-colors",+ "hover:bg-muted/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",+ )}+ >+ <span className="flex size-12 items-center justify-center rounded-full bg-background/80 text-foreground transition-colors group-hover:bg-background">+ <PlayIcon className="size-5 translate-x-px fill-current" />+ </span>+ </button>+ )}+ </div>+ );+}+function generateCode(config: ComponentConfig, props: Record<string, unknown>) {const propsString = Object.entries(props).map(([k, v]) => {diff --git a/config/landing.ts b/config/landing.tsindex 267a2078..a0ed8722 100644--- a/config/landing.ts+++ b/config/landing.ts@@ -49,6 +49,17 @@ export const SPONSORS_NAV: NavLink[] = [{ href: "/docs/getting-started/introduction", label: "Docs" },];+// Docs reuses the global header but lives off-route, so section links must be+// root-absolute (`/#components`) — bare hash anchors would resolve to+// `/docs/<slug>#components` and scroll to nothing.+export const DOCS_NAV: NavLink[] = [+ { href: "/#components", label: "Components", smOnly: true },+ { href: "/#showcase", label: "Showcase", smOnly: true },+ { href: "/#get-started", label: "Get started", smOnly: true },+ { href: "/sponsors", label: "Sponsors", smOnly: true },+ { href: "/docs/getting-started/introduction", label: "Docs" },+];+export const FOOTER_NAV: NavLink[] = [{ href: "/docs/getting-started/introduction", label: "Docs" },{ href: GITHUB_URL, label: "GitHub" },diff --git a/lib/layout.shared.tsx b/lib/layout.shared.tsxindex 1dab78de..b4cf7388 100644--- a/lib/layout.shared.tsx+++ b/lib/layout.shared.tsx@@ -1,23 +1,14 @@-import Image from "next/image";import type { BaseLayoutProps } from "fumadocs-ui/layouts/shared";+// The custom `SiteHeader` (mounted in `app/docs/layout.tsx`) owns the only top+// bar, and `DocsLayout` is passed `nav={{ enabled: false }}`. So this no longer+// supplies a Fumadocs `nav.title` / `links` / `githubUrl` — doing so would only+// feed a second, suppressed header. Theme + i18n remain Fumadocs' job via+// `RootProvider`, untouched here.export function baseOptions(): BaseLayoutProps {return {nav: {- title: (- <span className="flex items-center gap-2 font-semibold tracking-tight">- <Image src="/logo.svg" alt="remocn logo" width={20} height={20} />- remocn- </span>- ),+ enabled: false,},- githubUrl: "https://github.com/remocn/remocn",- links: [- {- text: "Documentation",- url: "/docs/getting-started/introduction",- active: "nested-url",- },- ],};}diff --git a/mdx-components.tsx b/mdx-components.tsxindex 74233706..27ec98c7 100644--- a/mdx-components.tsx+++ b/mdx-components.tsx@@ -7,9 +7,30 @@ import { Dependencies } from "@/components/docs/dependencies";import { InstallBlock } from "@/components/docs/install-block";import { PropsTable } from "@/components/docs/props-table";+/**+ * MDX prose mapping for remocn docs.+ *+ * Fumadocs' `defaultMdxComponents` is spread as the base — its machinery must+ * stay intact: heading anchors + scroll IDs (`Heading`), the Shiki+ * `CodeBlock`/`Pre` wiring that emits the `figure.shiki` markup, the+ * internal-aware `Link`, and the overflow-wrapped `Table`. Reimplementing any+ * of these would break code highlighting, copy buttons, and heading deep-links.+ *+ * The remocn *visual* restyle that de-templates the default Fumadocs prose is+ * delivered through the token-driven `.prose` rules in `app/globals.css`+ * (headings → display H1 + sans h2–h4, links → `foreground`/`accent` with a+ * focus-visible ring, code/Shiki → `muted` token surface, tables → token+ * hairlines + muted header). That keeps every prose element on our oklch+ * tokens — no default-blue links, no templated heading look — without forking+ * the Fumadocs components here.+ *+ * Custom doc widgets are registered as-is (other lanes own their internals).+ */export function getMDXComponents(components?: MDXComponents): MDXComponents {return {...(defaultMdxComponents as MDXComponents),++ // Custom doc widgets — registrations only, not reimplemented here.ComponentPreview,InstallBlock,PropsTable,@@ -17,6 +38,7 @@ export function getMDXComponents(components?: MDXComponents): MDXComponents {Warning,Dependencies,ComponentCardGrid,+...components,};}