Skip to content

Production-ready animations, transitions, backgrounds, and scenes for Remotion

feat: added badge new, paths config, render into docs sidebar

dev_wandry752c62426db8
diff --git a/app/docs/layout.tsx b/app/docs/layout.tsx
index 7f903769..e914783a 100644
--- a/app/docs/layout.tsx
+++ b/app/docs/layout.tsx
@@ -2,6 +2,7 @@ import { DocsLayout } from "fumadocs-ui/layouts/docs";
import type { ReactNode } from "react";
import { DocsHeader } from "@/components/docs/docs-header";
import { baseOptions } from "@/lib/layout.shared";
+import { withNewBadges } from "@/lib/with-new-badges";
import { source } from "@/source";
export default async function Layout({ children }: { children: ReactNode }) {
@@ -12,7 +13,10 @@ export default async function Layout({ children }: { children: ReactNode }) {
sidebar, nav starting at the article column's left edge. */}
<DocsHeader />
<DocsLayout
- tree={source.pageTree}
+ // Decorate the shared page tree with the animated "NEW" sidebar badge
+ // for pages listed in `NEW_BADGE_PATHS` (immutable copy — see
+ // `withNewBadges`). Everything else passes through untouched.
+ tree={withNewBadges(source.pageTree)}
{...baseOptions()}
// Suppress the Fumadocs default top nav so there is no double header —
// `SiteHeader` above is the single top bar. Verified against
diff --git a/app/globals.css b/app/globals.css
index aea53c34..1d82cf57 100644
--- a/app/globals.css
+++ b/app/globals.css
@@ -84,6 +84,12 @@
--sidebar-accent-foreground: oklch(0.205 0 0);
--sidebar-border: oklch(0.922 0 0);
--sidebar-ring: oklch(0.708 0 0);
+
+ /* "NEW" sidebar badge — editable accent. Theme-agnostic for now (same value
+ in light/dark); recolor the badge by changing --badge-new-bg here. The fg
+ stays dark so the label reads on the light-lime background. */
+ --badge-new-bg: rgb(195, 232, 141);
+ --badge-new-fg: oklch(0.205 0 0);
}
.dark {
@@ -119,6 +125,10 @@
--sidebar-accent-foreground: oklch(0.95 0 0);
--sidebar-border: oklch(1 0 0 / 6%);
--sidebar-ring: oklch(1 0 0 / 20%);
+
+ /* Badge keeps the same lime accent in dark mode — see :root for the knob. */
+ --badge-new-bg: rgb(195, 232, 141);
+ --badge-new-fg: oklch(0.205 0 0);
}
@layer base {
diff --git a/bun.lock b/bun.lock
index 8b83dd39..a7605c64 100644
--- a/bun.lock
+++ b/bun.lock
@@ -24,7 +24,7 @@
"input-otp": "^1.4.2",
"jotai": "^2.19.1",
"lucide-react": "^1.7.0",
- "motion": "^12.38.0",
+ "motion": "^12.40.0",
"next": "16.2.2",
"next-themes": "^0.4.6",
"nuqs": "^2.8.9",
@@ -990,7 +990,7 @@
"forwarded": ["[email protected]", "", {}, "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow=="],
- "framer-motion": ["[email protected]", "", { "dependencies": { "motion-dom": "^12.38.0", "motion-utils": "^12.36.0", "tslib": "^2.4.0" }, "peerDependencies": { "@emotion/is-prop-valid": "*", "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0" }, "optionalPeers": ["@emotion/is-prop-valid", "react", "react-dom"] }, "sha512-rFYkY/pigbcswl1XQSb7q424kSTQ8q6eAC+YUsSKooHQYuLdzdHjrt6uxUC+PRAO++q5IS7+TamgIw1AphxR+g=="],
+ "framer-motion": ["[email protected]", "", { "dependencies": { "motion-dom": "^12.40.0", "motion-utils": "^12.39.0", "tslib": "^2.4.0" }, "peerDependencies": { "@emotion/is-prop-valid": "*", "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0" }, "optionalPeers": ["@emotion/is-prop-valid", "react", "react-dom"] }, "sha512-uaBd3qC1v3KQqBEjwTUd183K6PbS+j0yR9w9VmEOLWA/tnUcSn8Xa3uck7t4dgpDoUss8xQTcj8W2L07lrnLFg=="],
"fresh": ["[email protected]", "", {}, "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A=="],
@@ -1354,11 +1354,11 @@
"mitt": ["[email protected]", "", {}, "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw=="],
- "motion": ["[email protected]", "", { "dependencies": { "framer-motion": "^12.38.0", "tslib": "^2.4.0" }, "peerDependencies": { "@emotion/is-prop-valid": "*", "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0" }, "optionalPeers": ["@emotion/is-prop-valid", "react", "react-dom"] }, "sha512-uYfXzeHlgThchzwz5Te47dlv5JOUC7OB4rjJ/7XTUgtBZD8CchMN8qEJ4ZVsUmTyYA44zjV0fBwsiktRuFnn+w=="],
+ "motion": ["[email protected]", "", { "dependencies": { "framer-motion": "^12.40.0", "tslib": "^2.4.0" }, "peerDependencies": { "@emotion/is-prop-valid": "*", "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0" }, "optionalPeers": ["@emotion/is-prop-valid", "react", "react-dom"] }, "sha512-yjrHUrBFW6kQvjJwRsoiPSAhC5tRwRqNGJWmiJ4CrGnbKp0V88AdzkhBmDoqIsIPfarOe0Uddd37Xq43/gIocA=="],
- "motion-dom": ["[email protected]", "", { "dependencies": { "motion-utils": "^12.36.0" } }, "sha512-pdkHLD8QYRp8VfiNLb8xIBJis1byQ9gPT3Jnh2jqfFtAsWUA3dEepDlsWe/xMpO8McV+VdpKVcp+E+TGJEtOoA=="],
+ "motion-dom": ["[email protected]", "", { "dependencies": { "motion-utils": "^12.39.0" } }, "sha512-HxU3ZaBwNPVQUBQf1xxgq+7JrPNZvjLVxgbpEZL7RrWJnsxOf0/OM+yrHG9ogLQ31Do/r57Oz2gQWPK+6q62mg=="],
- "motion-utils": ["[email protected]", "", {}, "sha512-eHWisygbiwVvf6PZ1vhaHCLamvkSbPIeAYxWUuL3a2PD/TROgE7FvfHWTIH4vMl798QLfMw15nRqIaRDXTlYRg=="],
+ "motion-utils": ["[email protected]", "", {}, "sha512-8nadJAJjTtqRkmRF36FoJTrywK9nnFmnPwnSMyxaOCU7GDjN9RTMJIxx9De8ErM+vpPhMccr/6fo5WciyQLnMQ=="],
"ms": ["[email protected]", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="],
@@ -1862,6 +1862,8 @@
"fumadocs-mdx/esbuild": ["[email protected]", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.27.7", "@esbuild/android-arm": "0.27.7", "@esbuild/android-arm64": "0.27.7", "@esbuild/android-x64": "0.27.7", "@esbuild/darwin-arm64": "0.27.7", "@esbuild/darwin-x64": "0.27.7", "@esbuild/freebsd-arm64": "0.27.7", "@esbuild/freebsd-x64": "0.27.7", "@esbuild/linux-arm": "0.27.7", "@esbuild/linux-arm64": "0.27.7", "@esbuild/linux-ia32": "0.27.7", "@esbuild/linux-loong64": "0.27.7", "@esbuild/linux-mips64el": "0.27.7", "@esbuild/linux-ppc64": "0.27.7", "@esbuild/linux-riscv64": "0.27.7", "@esbuild/linux-s390x": "0.27.7", "@esbuild/linux-x64": "0.27.7", "@esbuild/netbsd-arm64": "0.27.7", "@esbuild/netbsd-x64": "0.27.7", "@esbuild/openbsd-arm64": "0.27.7", "@esbuild/openbsd-x64": "0.27.7", "@esbuild/openharmony-arm64": "0.27.7", "@esbuild/sunos-x64": "0.27.7", "@esbuild/win32-arm64": "0.27.7", "@esbuild/win32-ia32": "0.27.7", "@esbuild/win32-x64": "0.27.7" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-IxpibTjyVnmrIQo5aqNpCgoACA/dTKLTlhMHihVHhdkxKyPO1uBBthumT0rdHmcsk9uMonIWS0m4FljWzILh3w=="],
+ "fumadocs-ui/motion": ["[email protected]", "", { "dependencies": { "framer-motion": "^12.38.0", "tslib": "^2.4.0" }, "peerDependencies": { "@emotion/is-prop-valid": "*", "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0" }, "optionalPeers": ["@emotion/is-prop-valid", "react", "react-dom"] }, "sha512-uYfXzeHlgThchzwz5Te47dlv5JOUC7OB4rjJ/7XTUgtBZD8CchMN8qEJ4ZVsUmTyYA44zjV0fBwsiktRuFnn+w=="],
+
"is-inside-container/is-docker": ["[email protected]", "", { "bin": { "is-docker": "cli.js" } }, "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ=="],
"log-symbols/is-unicode-supported": ["[email protected]", "", {}, "sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ=="],
@@ -1974,6 +1976,8 @@
"fumadocs-mdx/esbuild/@esbuild/win32-x64": ["@esbuild/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-56hiAJPhwQ1R4i+21FVF7V8kSD5zZTdHcVuRFMW0hn753vVfQN8xlx4uOPT4xoGH0Z/oVATuR82AiqSTDIpaHg=="],
+ "fumadocs-ui/motion/framer-motion": ["[email protected]", "", { "dependencies": { "motion-dom": "^12.38.0", "motion-utils": "^12.36.0", "tslib": "^2.4.0" }, "peerDependencies": { "@emotion/is-prop-valid": "*", "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0" }, "optionalPeers": ["@emotion/is-prop-valid", "react", "react-dom"] }, "sha512-rFYkY/pigbcswl1XQSb7q424kSTQ8q6eAC+YUsSKooHQYuLdzdHjrt6uxUC+PRAO++q5IS7+TamgIw1AphxR+g=="],
+
"send/mime-types/mime-db": ["[email protected]", "", {}, "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ=="],
"shadcn/execa/get-stream": ["[email protected]", "", { "dependencies": { "@sec-ant/readable-stream": "^0.4.1", "is-stream": "^4.0.1" } }, "sha512-kVCxPF3vQM/N0B1PmoqVUqgHP+EeVjmZSQn+1oCRPxd2P21P2F19lIgbR3HBosbB1PUhOAoctJnfEn2GbN2eZA=="],
@@ -1998,6 +2002,10 @@
"yargs/string-width/strip-ansi": ["[email protected]", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="],
+ "fumadocs-ui/motion/framer-motion/motion-dom": ["[email protected]", "", { "dependencies": { "motion-utils": "^12.36.0" } }, "sha512-pdkHLD8QYRp8VfiNLb8xIBJis1byQ9gPT3Jnh2jqfFtAsWUA3dEepDlsWe/xMpO8McV+VdpKVcp+E+TGJEtOoA=="],
+
+ "fumadocs-ui/motion/framer-motion/motion-utils": ["[email protected]", "", {}, "sha512-eHWisygbiwVvf6PZ1vhaHCLamvkSbPIeAYxWUuL3a2PD/TROgE7FvfHWTIH4vMl798QLfMw15nRqIaRDXTlYRg=="],
+
"shadcn/execa/npm-run-path/path-key": ["[email protected]", "", {}, "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ=="],
"yargs/string-width/strip-ansi/ansi-regex": ["[email protected]", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],
diff --git a/components.json b/components.json
index 7f5f668b..a0226918 100644
--- a/components.json
+++ b/components.json
@@ -23,6 +23,7 @@
},
"registries": {
"@react-bits": "https://reactbits.dev/r/{name}.json",
- "@svgl": "https://svgl.app/r/{name}.json"
+ "@svgl": "https://svgl.app/r/{name}.json",
+ "@ncdai": "https://chanhdai.com/r/{name}.json"
}
}
diff --git a/components/docs/new-badge.tsx b/components/docs/new-badge.tsx
new file mode 100644
index 00000000..41c7dfb5
--- /dev/null
+++ b/components/docs/new-badge.tsx
@@ -0,0 +1,28 @@
+import { ShimmeringText } from "@/components/shimmering-text";
+import { cn } from "@/lib/utils";
+
+/**
+ * Animated "NEW" tag for docs sidebar menu items. Built on the shimmering-text
+ * primitive so the letters sweep between `--color` and `--shimmering-color`.
+ * The pill sits on the `--badge-new-bg` accent (an editable token in
+ * globals.css); the shimmer runs in dark `--badge-new-fg` tones so the label
+ * stays legible on that light background in both themes.
+ *
+ * Rendered inline after a sidebar item's label (`ms-auto` pushes it to the rail
+ * edge — the Fumadocs sidebar link is a flex row). `ShimmeringText` already
+ * emits an `sr-only` "NEW" label and marks the animated glyphs `aria-hidden`,
+ * so the badge stays accessible without extra wiring.
+ */
+export function NewBadge({ className }: { className?: string }) {
+ return (
+ <ShimmeringText
+ text="NEW"
+ duration={1.2}
+ className={cn(
+ "ms-auto rounded-full px-1.5 text-[10px] font-semibold uppercase leading-[1.45] tracking-wide",
+ "bg-[var(--badge-new-bg)] [--color:var(--badge-new-fg)] [--shimmering-color:color-mix(in_oklch,var(--badge-new-fg),transparent_55%)]",
+ className,
+ )}
+ />
+ );
+}
diff --git a/components/shimmering-text.tsx b/components/shimmering-text.tsx
new file mode 100644
index 00000000..f8c22b17
--- /dev/null
+++ b/components/shimmering-text.tsx
@@ -0,0 +1,80 @@
+"use client"
+
+import * as React from "react"
+import type { Variants } from "motion/react"
+import { motion } from "motion/react"
+
+import { cn } from "@/lib/utils"
+
+export type ShimmeringTextProps = Omit<
+ React.ComponentProps<typeof motion.span>,
+ "children"
+> & {
+ /** The text to render with the shimmering effect. */
+ text: string
+ /**
+ * Duration in seconds for one shimmer cycle.
+ * @defaultValue 1 */
+ duration?: number
+ /**
+ * Whether the shimmer animation is paused.
+ * @defaultValue false */
+ isStopped?: boolean
+}
+
+export function ShimmeringText({
+ text,
+ duration = 1,
+ isStopped = false,
+ className,
+ ...props
+}: ShimmeringTextProps) {
+ const createCharVariants = React.useCallback(
+ (charIndex: number): Variants => ({
+ running: {
+ color: ["var(--color)", "var(--shimmering-color)", "var(--color)"],
+ transition: {
+ duration,
+ repeat: Infinity,
+ repeatType: "loop" as const,
+ repeatDelay: text.length * 0.05,
+ delay: (charIndex * duration) / text.length,
+ ease: "easeInOut",
+ },
+ },
+ stopped: {
+ color: "var(--color)",
+ transition: {
+ duration: duration * 0.5,
+ ease: "easeOut",
+ },
+ },
+ }),
+ [duration, text.length]
+ )
+
+ return (
+ <motion.span
+ className={cn(
+ "inline-block select-none",
+ "[--color:var(--muted-foreground)] [--shimmering-color:var(--foreground)]",
+ className
+ )}
+ {...props}
+ >
+ {text?.split("")?.map((char, i) => (
+ <motion.span
+ key={i}
+ className="inline-block whitespace-pre"
+ initial="stopped"
+ animate={isStopped ? "stopped" : "running"}
+ variants={createCharVariants(i)}
+ aria-hidden
+ >
+ {char}
+ </motion.span>
+ ))}
+ <span className="sr-only">{text}</span>
+ </motion.span>
+ )
+}
diff --git a/config/site.ts b/config/site.ts
index b6a6deb8..db47d510 100644
--- a/config/site.ts
+++ b/config/site.ts
@@ -34,6 +34,15 @@ export const NAV_LINKS: NavLink[] = [
{ href: "/docs/getting-started/introduction", label: "Docs" },
];
+/**
+ * Docs whose sidebar menu item should carry the animated "NEW" badge. Keyed by
+ * the page's docs URL (the Fumadocs page-tree `item.url`). Add a path here to
+ * tag another menu item — no component changes needed. See `withNewBadges`.
+ */
+export const NEW_BADGE_PATHS = new Set<string>([
+ "/docs/social/github-stars",
+]);
+
export const FOOTER_NAV: NavLink[] = [
{ href: "/docs/getting-started/introduction", label: "Docs" },
{ href: GITHUB_URL, label: "GitHub" },
diff --git a/lib/with-new-badges.tsx b/lib/with-new-badges.tsx
new file mode 100644
index 00000000..2ec3cac4
--- /dev/null
+++ b/lib/with-new-badges.tsx
@@ -0,0 +1,47 @@
+import type { Item, Node, Root } from "fumadocs-core/page-tree";
+import { NewBadge } from "@/components/docs/new-badge";
+import { NEW_BADGE_PATHS } from "@/config/site";
+
+/**
+ * Returns a copy of the Fumadocs page tree with an animated {@link NewBadge}
+ * appended to the label of every sidebar item whose `url` is listed in
+ * {@link NEW_BADGE_PATHS}. The Fumadocs sidebar renders an item's `name`
+ * (a `ReactNode`) verbatim, so wrapping it as `<>{name} <NewBadge/></>` is all
+ * that's needed to surface the badge in the rail.
+ *
+ * The walk is immutable — `source.pageTree` is built once and shared across
+ * requests, so mutating it in place would let badges accumulate on the same
+ * node across renders. Every touched node is shallow-cloned instead.
+ */
+export function withNewBadges(tree: Root): Root {
+ return { ...tree, children: tree.children.map(decorate) };
+}
+
+function decorate(node: Node): Node {
+ if (node.type === "page") return decorateItem(node);
+ if (node.type === "folder") {
+ return {
+ ...node,
+ // `folder.index` is the folder's own landing page — decorate it too so a
+ // badged folder index doesn't lose its tag, then recurse the children.
+ index: node.index ? decorateItem(node.index) : node.index,
+ children: node.children.map(decorate),
+ };
+ }
+ return node;
+}
+
+/** Append the badge to a page item's label when its url is opted in. */
+function decorateItem(item: Item): Item {
+ return NEW_BADGE_PATHS.has(item.url)
+ ? {
+ ...item,
+ name: (
+ <>
+ {item.name}
+ <NewBadge />
+ </>
+ ),
+ }
+ : item;
+}
diff --git a/package.json b/package.json
index 3f62ea79..88f019ac 100644
--- a/package.json
+++ b/package.json
@@ -33,7 +33,7 @@
"input-otp": "^1.4.2",
"jotai": "^2.19.1",
"lucide-react": "^1.7.0",
- "motion": "^12.38.0",
+ "motion": "^12.40.0",
"next": "16.2.2",
"next-themes": "^0.4.6",
"nuqs": "^2.8.9",