Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

feat(sandbox): Figma-style dashboard layout with card grid (#917)

rubyycheung00d070f00cc1
diff --git a/apps/sandbox/public/previews/README.md b/apps/sandbox/public/previews/README.md
new file mode 100644
index 0000000000..208d1c6817
--- /dev/null
+++ b/apps/sandbox/public/previews/README.md
@@ -0,0 +1 @@
+Preview screenshots go here. Capture with the sandbox running and save as <page-slug>.png.
diff --git a/apps/sandbox/scripts/capture-previews.mjs b/apps/sandbox/scripts/capture-previews.mjs
new file mode 100644
index 0000000000..3ebfef16c5
--- /dev/null
+++ b/apps/sandbox/scripts/capture-previews.mjs
@@ -0,0 +1,77 @@
+#!/usr/bin/env node
+/**
+ * Capture preview screenshots for all sandbox pages.
+ *
+ * Usage:
+ * # Start the sandbox dev server first:
+ * yarn workspace @xds/sandbox dev
+ *
+ * # Then run this script:
+ * node apps/sandbox/scripts/capture-previews.mjs [--base-url http://localhost:3000]
+ *
+ * The script navigates to each page registered in sandboxPages.ts,
+ * waits for it to load, and saves a 16:10 screenshot to public/previews/.
+ *
+ * Requirements: npx playwright install chromium
+ */
+
+import {chromium} from 'playwright';
+import {mkdir} from 'fs/promises';
+import {fileURLToPath} from 'url';
+import path from 'path';
+
+const __dirname = path.dirname(fileURLToPath(import.meta.url));
+const previewDir = path.resolve(__dirname, '../public/previews');
+
+const pages = [
+ {slug: 'theme-editor', href: '/pages/theme-editor/'},
+ {slug: 'shell-lab', href: '/pages/shell-lab/'},
+ {slug: 'table-overview', href: '/pages/table-overview/'},
+ {slug: 'navigation', href: '/pages/navigation/'},
+ {slug: 'topnav-menu', href: '/pages/topnav-menu/'},
+ {slug: 'mega-menu', href: '/pages/mega-menu/'},
+ {slug: 'polymorphic-link', href: '/pages/polymorphic-link/'},
+ {slug: 'example', href: '/pages/example/'},
+];
+
+const baseUrl = process.argv.includes('--base-url')
+ ? process.argv[process.argv.indexOf('--base-url') + 1]
+ : 'http://localhost:3000';
+
+async function main() {
+ await mkdir(previewDir, {recursive: true});
+
+ const browser = await chromium.launch();
+ const context = await browser.newContext({
+ viewport: {width: 1280, height: 800},
+ deviceScaleFactor: 2,
+ });
+
+ console.log(`Capturing previews from ${baseUrl}...\n`);
+
+ for (const page of pages) {
+ const url = `${baseUrl}${page.href}`;
+ const tab = await context.newPage();
+
+ try {
+ await tab.goto(url, {waitUntil: 'networkidle'});
+ await tab.waitForTimeout(500);
+
+ const outPath = path.join(previewDir, `${page.slug}.png`);
+ await tab.screenshot({
+ path: outPath,
+ clip: {x: 0, y: 0, width: 1280, height: 800},
+ });
+ console.log(` ✓ ${page.slug}.png`);
+ } catch (err) {
+ console.log(` ✗ ${page.slug} — ${err.message}`);
+ }
+
+ await tab.close();
+ }
+
+ await browser.close();
+ console.log(`\nDone. Screenshots saved to ${previewDir}`);
+}
+
+main().catch(console.error);
diff --git a/apps/sandbox/src/app/(sandbox)/[category]/CategoryContent.tsx b/apps/sandbox/src/app/(sandbox)/[category]/CategoryContent.tsx
new file mode 100644
index 0000000000..77a2e298e8
--- /dev/null
+++ b/apps/sandbox/src/app/(sandbox)/[category]/CategoryContent.tsx
@@ -0,0 +1,41 @@
+'use client';
+
+import {XDSHeading, XDSText} from '@xds/core/Text';
+import {categories} from '../../sandboxPages';
+import {ProjectCard} from '../../ProjectCard';
+
+export function CategoryContent({slug}: {slug: string}) {
+ const category = categories.find(c => c.slug === slug);
+
+ if (!category) {
+ return (
+ <div>
+ <XDSHeading level={1}>Not Found</XDSHeading>
+ <XDSText type="body" color="secondary">
+ Category &quot;{slug}&quot; doesn&apos;t exist.
+ </XDSText>
+ </div>
+ );
+ }
+
+ return (
+ <div style={{display: 'flex', flexDirection: 'column', gap: 24}}>
+ <div style={{display: 'flex', flexDirection: 'column', gap: 4}}>
+ <XDSHeading level={1}>{category.label}</XDSHeading>
+ <XDSText type="body" color="secondary">
+ {category.description}
+ </XDSText>
+ </div>
+ <div
+ style={{
+ display: 'grid',
+ gridTemplateColumns: 'repeat(3, 1fr)',
+ gap: 20,
+ }}>
+ {category.pages.map(page => (
+ <ProjectCard key={page.href} page={page} />
+ ))}
+ </div>
+ </div>
+ );
+}
diff --git a/apps/sandbox/src/app/(sandbox)/[category]/page.tsx b/apps/sandbox/src/app/(sandbox)/[category]/page.tsx
new file mode 100644
index 0000000000..f887061b90
--- /dev/null
+++ b/apps/sandbox/src/app/(sandbox)/[category]/page.tsx
@@ -0,0 +1,16 @@
+import {categories} from '../../sandboxPages';
+import {CategoryContent} from './CategoryContent';
+
+// Required for static export — pre-generate all category pages
+export function generateStaticParams() {
+ return categories.map(c => ({category: c.slug}));
+}
+
+export default async function CategoryPage({
+ params,
+}: {
+ params: Promise<{category: string}>;
+}) {
+ const {category: slug} = await params;
+ return <CategoryContent slug={slug} />;
+}
diff --git a/apps/sandbox/src/app/(sandbox)/layout.tsx b/apps/sandbox/src/app/(sandbox)/layout.tsx
index 648d8b6e29..4b598e2176 100644
--- a/apps/sandbox/src/app/(sandbox)/layout.tsx
+++ b/apps/sandbox/src/app/(sandbox)/layout.tsx
@@ -1,14 +1,9 @@
-import {XDSAppShell} from '@xds/core/AppShell';
-import {SandboxTopNav} from '../SandboxTopNav';
-import {SandboxNav} from '../SandboxNav';
+import {SandboxShell} from '../SandboxShell';
-export default function SandboxLayout({children}: {children: React.ReactNode}) {
- return (
- <XDSAppShell
- topNav={<SandboxTopNav />}
- sideNav={<SandboxNav />}
- contentPadding={4}>
- {children}
- </XDSAppShell>
- );
+export default function SandboxLayout({
+ children,
+}: {
+ children: React.ReactNode;
+}) {
+ return <SandboxShell>{children}</SandboxShell>;
}
diff --git a/apps/sandbox/src/app/(sandbox)/page.tsx b/apps/sandbox/src/app/(sandbox)/page.tsx
index b363381b87..4b60aee796 100644
--- a/apps/sandbox/src/app/(sandbox)/page.tsx
+++ b/apps/sandbox/src/app/(sandbox)/page.tsx
@@ -1,31 +1,46 @@
'use client';
-import * as stylex from '@stylexjs/stylex';
-import {XDSVStack} from '@xds/core/Layout';
import {XDSText, XDSHeading} from '@xds/core/Text';
-
-const styles = stylex.create({
- container: {
- maxWidth: 640,
- },
-});
+import {categories} from '../sandboxPages';
+import {ProjectCard} from '../ProjectCard';
export default function Home() {
return (
- <div {...stylex.props(styles.container)}>
- <XDSVStack gap={6}>
- <XDSVStack gap={2}>
- <XDSHeading level={1}>XDS Sandbox</XDSHeading>
- <XDSText type="body" color="secondary">
- A testing ground for XDS components. Use the sidebar to explore
- example pages, or create new ones under{' '}
- <XDSText type="body" weight="bold">
- src/app/pages/
- </XDSText>
- .
+ <div style={{display: 'flex', flexDirection: 'column', gap: 40}}>
+ <div style={{display: 'flex', flexDirection: 'column', gap: 8}}>
+ <XDSHeading level={1}>XDS Sandbox</XDSHeading>
+ <XDSText type="body" color="secondary">
+ A testing ground for XDS components. Explore tools and templates
+ below, or create new pages under{' '}
+ <XDSText type="body" weight="bold">
+ src/app/pages/
</XDSText>
- </XDSVStack>
- </XDSVStack>
+ .
+ </XDSText>
+ </div>
+
+ {categories.map(category => (
+ <div
+ key={category.slug}
+ style={{display: 'flex', flexDirection: 'column', gap: 16}}>
+ <div style={{display: 'flex', flexDirection: 'column', gap: 4}}>
+ <XDSHeading level={2}>{category.label}</XDSHeading>
+ <XDSText type="body" color="secondary">
+ {category.description}
+ </XDSText>
+ </div>
+ <div
+ style={{
+ display: 'grid',
+ gridTemplateColumns: 'repeat(3, 1fr)',
+ gap: 20,
+ }}>
+ {category.pages.map(page => (
+ <ProjectCard key={page.href} page={page} />
+ ))}
+ </div>
+ </div>
+ ))}
</div>
);
}
diff --git a/apps/sandbox/src/app/ProjectCard.tsx b/apps/sandbox/src/app/ProjectCard.tsx
new file mode 100644
index 0000000000..45397cca2b
--- /dev/null
+++ b/apps/sandbox/src/app/ProjectCard.tsx
@@ -0,0 +1,74 @@
+'use client';
+
+import {XDSText} from '@xds/core/Text';
+import type {SandboxPage} from './sandboxPages';
+import {ImageIcon} from './icons';
+
+export function ProjectCard({page}: {page: SandboxPage}) {
+ return (
+ <a
+ href={page.href}
+ target="_blank"
+ rel="noopener noreferrer"
+ style={{
+ textDecoration: 'none',
+ color: 'inherit',
+ display: 'flex',
+ }}>
+ <div
+ style={{
+ display: 'flex',
+ flexDirection: 'column',
+ width: '100%',
+ borderRadius: 12,
+ border: '1px solid var(--color-border-emphasized)',
+ backgroundColor: 'var(--color-background-card)',
+ overflow: 'hidden',
+ }}>
+ <div
+ style={{
+ width: '100%',
+ height: 160,
+ backgroundColor: 'var(--color-background-body)',
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ overflow: 'hidden',
+ flexShrink: 0,
+ }}>
+ {page.preview ? (
+ <img
+ src={page.preview}
+ alt={`Preview of ${page.name}`}
+ style={{width: '100%', height: '100%', objectFit: 'cover'}}
+ />
+ ) : (
+ <ImageIcon
+ style={{
+ width: 48,
+ height: 48,
+ opacity: 0.3,
+ color: 'var(--color-text-disabled)',
+ }}
+ />
+ )}
+ </div>
+ <div
+ style={{
+ display: 'flex',
+ flexDirection: 'column',
+ gap: 4,
+ padding: '12px 16px',
+ flex: 1,
+ }}>
+ <XDSText type="body" weight="semibold" maxLines={1}>
+ {page.name}
+ </XDSText>
+ <XDSText type="body" size="sm" color="secondary" maxLines={2}>
+ {page.description}
+ </XDSText>
+ </div>
+ </div>
+ </a>
+ );
+}
diff --git a/apps/sandbox/src/app/SandboxNav.tsx b/apps/sandbox/src/app/SandboxNav.tsx
index 4288fb685b..033af190d4 100644
--- a/apps/sandbox/src/app/SandboxNav.tsx
+++ b/apps/sandbox/src/app/SandboxNav.tsx
@@ -1,84 +1,126 @@
'use client';
+import * as stylex from '@stylexjs/stylex';
import {usePathname} from 'next/navigation';
import Link from 'next/link';
-import {
- XDSSideNav,
- XDSSideNavHeading,
- XDSSideNavItem,
- XDSSideNavSection,
-} from '@xds/core/SideNav';
-import {XDSSelector} from '@xds/core/Selector';
+import {XDSSideNav, XDSSideNavItem, XDSSideNavSection} from '@xds/core/SideNav';
+import {XDSDropdownMenu} from '@xds/core/DropdownMenu';
+import {XDSText} from '@xds/core/Text';
import {useThemeControls} from './providers';
import type {ThemeMode} from '@xds/core/theme';
+import {categories} from './sandboxPages';
+import {
+ HomeIcon,
+ WrenchIcon,
+ LayoutTemplateIcon,
+ PaletteIcon,
+ SunIcon,
+ MoonIcon,
+} from './icons';
+import {spacingVars, colorVars} from '@xds/core/theme/tokens.stylex';
+
+const categoryIcons: Record<
+ string,
+ React.ComponentType<React.SVGProps<SVGSVGElement>>
+> = {
+ tools: WrenchIcon,
+ templates: LayoutTemplateIcon,
+};
+
+const styles = stylex.create({
+ header: {
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'space-between',
+ paddingInline: spacingVars['--spacing-4'],
+ paddingBlock: spacingVars['--spacing-3'],
+ borderBottomWidth: 1,
+ borderBottomStyle: 'solid',
+ borderBottomColor: colorVars['--color-border'],
+ },
+ controls: {
+ display: 'flex',
+ gap: 2,
+ },
+});
-const pages = [
- {name: 'Home', href: '/'},
- {name: 'Theme Editor', href: '/pages/theme-editor/'},
- {name: 'Shell Lab', href: '/pages/shell-lab/'},
- {name: 'Example', href: '/pages/example/'},
- {name: 'Navigation', href: '/pages/navigation/'},
- {name: 'TopNav Menu', href: '/pages/topnav-menu/'},
- {name: 'Mega Menu', href: '/pages/mega-menu/'},
- {name: 'Polymorphic Link', href: '/pages/polymorphic-link/'},
- {name: 'Table Overview', href: '/pages/table-overview/'},
-];
+function SandboxHeader() {
+ const {setThemeName, mode, setMode} = useThemeControls();
+
+ const themeItems = [
+ {label: 'Default', onClick: () => setThemeName('default')},
+ {label: 'Neutral', onClick: () => setThemeName('neutral')},
+ {label: 'Brutalist', onClick: () => setThemeName('brutalist')},
+ {label: 'Meta', onClick: () => setThemeName('meta')},
+ {label: 'WhatsApp', onClick: () => setThemeName('whatsapp')},
+ ];
+
+ const modeItems = [
+ {label: 'Light', onClick: () => setMode('light' as ThemeMode)},
+ {label: 'Dark', onClick: () => setMode('dark' as ThemeMode)},
+ ];
+
+ return (
+ <div {...stylex.props(styles.header)}>
+ <XDSText type="body" weight="bold">
+ Sandbox
+ </XDSText>
+ <div {...stylex.props(styles.controls)}>
+ <XDSDropdownMenu
+ button={{
+ label: 'Theme',
+ icon: <PaletteIcon />,
+ variant: 'ghost',
+ size: 'sm',
+ }}
+ menuWidth={160}
+ items={themeItems}
+ />
+ <XDSDropdownMenu
+ button={{
+ label: mode === 'dark' ? 'Dark mode' : 'Light mode',
+ icon: mode === 'dark' ? <MoonIcon /> : <SunIcon />,
+ variant: 'ghost',
+ size: 'sm',
+ }}
+ menuWidth={160}
+ items={modeItems}
+ />
+ </div>
+ </div>
+ );
+}
export function SandboxNav() {
const pathname = usePathname();
- const {themeName, setThemeName, mode, setMode} = useThemeControls();
return (
- <XDSSideNav header={<XDSSideNavHeading heading="Sandbox" />}>
- <XDSSideNavSection title="Pages" isHeaderHidden>
- {pages.map(page => {
- const isActive =
- pathname === page.href ||
- (page.href !== '/' && pathname.startsWith(page.href));
+ <XDSSideNav header={<SandboxHeader />}>
+ <XDSSideNavSection title="Home" isHeaderHidden>
+ <XDSSideNavItem
+ label="Home"
+ href="/"
+ isSelected={pathname === '/'}
+ as={Link}
+ icon={HomeIcon}
+ />
+ </XDSSideNavSection>
+ <XDSSideNavSection title="Projects">
+ {categories.map(category => {
+ const isActive = pathname === `/${category.slug}/`;
+ const IconComponent = categoryIcons[category.slug];
return (
<XDSSideNavItem
- key={page.href}
- label={page.name}
- href={page.href}
+ key={category.slug}
+ label={category.label}
+ href={`/${category.slug}/`}
isSelected={isActive}
as={Link}
+ icon={IconComponent}
/>
);
})}
</XDSSideNavSection>
- <XDSSideNavSection title="Theme">
- <div style={{padding: '0 12px'}}>
- <XDSSelector
- label="Theme"
- isLabelHidden
- size="sm"
- value={themeName}
- onChange={setThemeName}
- options={[
- {value: 'default', label: 'Default'},
- {value: 'neutral', label: 'Neutral'},
- {value: 'brutalist', label: 'Brutalist'},
- {value: 'meta', label: 'Meta'},
- {value: 'whatsapp', label: 'WhatsApp'},
- ]}
- />
- </div>
- </XDSSideNavSection>
- <XDSSideNavSection title="Mode">
- <div style={{padding: '0 12px'}}>
- <XDSSelector
- label="Mode"
- isLabelHidden
- size="sm"
- value={mode}
- onChange={v => setMode(v as ThemeMode)}
- options={[
- {value: 'light', label: 'Light'},
- {value: 'dark', label: 'Dark'},
- ]}
- />
- </div>
- </XDSSideNavSection>
</XDSSideNav>
);
}
diff --git a/apps/sandbox/src/app/SandboxShell.tsx b/apps/sandbox/src/app/SandboxShell.tsx
new file mode 100644
index 0000000000..1bb5463a67
--- /dev/null
+++ b/apps/sandbox/src/app/SandboxShell.tsx
@@ -0,0 +1,12 @@
+'use client';
+
+import {XDSAppShell} from '@xds/core/AppShell';
+import {SandboxNav} from './SandboxNav';
+
+export function SandboxShell({children}: {children: React.ReactNode}) {
+ return (
+ <XDSAppShell sideNav={<SandboxNav />} contentPadding={4}>
+ {children}
+ </XDSAppShell>
+ );
+}
diff --git a/apps/sandbox/src/app/SandboxTopNav.tsx b/apps/sandbox/src/app/SandboxTopNav.tsx
deleted file mode 100644
index cee3cf8491..0000000000
--- a/apps/sandbox/src/app/SandboxTopNav.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-'use client';
-
-import {XDSTopNav, XDSTopNavHeading} from '@xds/core/TopNav';
-
-export function SandboxTopNav() {
- return (
- <XDSTopNav
- label="Main navigation"
- heading={<XDSTopNavHeading heading="XDS Sandbox" />}
- />
- );
-}
diff --git a/apps/sandbox/src/app/icons.tsx b/apps/sandbox/src/app/icons.tsx
new file mode 100644
index 0000000000..fc6830d931
--- /dev/null
+++ b/apps/sandbox/src/app/icons.tsx
@@ -0,0 +1,127 @@
+/**
+ * @file icons.tsx
+ * @position Inline SVG icons used by the sandbox shell (sidebar + topnav).
+ *
+ * These are simple inline icons to avoid adding icon library dependencies
+ * to the sandbox app. Based on common Lucide/Feather-style strokes.
+ */
+
+import type {SVGProps} from 'react';
+
+type IconProps = SVGProps<SVGSVGElement>;
+
+export const WrenchIcon = (props: IconProps) => (
+ <svg
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ strokeWidth={2}
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ {...props}>
+ <path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z" />
+ </svg>
+);
+
+export const LayoutTemplateIcon = (props: IconProps) => (
+ <svg
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ strokeWidth={2}
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ {...props}>
+ <rect x="3" y="3" width="18" height="18" rx="2" />
+ <path d="M3 9h18" />
+ <path d="M9 21V9" />
+ </svg>
+);
+
+export const PaletteIcon = (props: IconProps) => (
+ <svg
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ strokeWidth={2}
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ {...props}>
+ <circle cx="13.5" cy="6.5" r="0.5" fill="currentColor" />
+ <circle cx="17.5" cy="10.5" r="0.5" fill="currentColor" />
+ <circle cx="8.5" cy="7.5" r="0.5" fill="currentColor" />
+ <circle cx="6.5" cy="12" r="0.5" fill="currentColor" />
+ <path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.9 0 1.5-.7 1.5-1.5 0-.4-.1-.7-.4-1-.3-.3-.4-.7-.4-1 0-.8.7-1.5 1.5-1.5H16c3.3 0 6-2.7 6-6 0-5.5-4.5-10-10-10z" />
+ </svg>
+);
+
+export const SunIcon = (props: IconProps) => (
+ <svg
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ strokeWidth={2}
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ {...props}>
+ <circle cx="12" cy="12" r="5" />
+ <path d="M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42" />
+ </svg>
+);
+
+export const MoonIcon = (props: IconProps) => (
+ <svg
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ strokeWidth={2}
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ {...props}>
+ <path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" />
+ </svg>
+);
+
+export const ExternalLinkIcon = (props: IconProps) => (
+ <svg
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ strokeWidth={2}
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ {...props}>
+ <path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" />
+ <polyline points="15 3 21 3 21 9" />
+ <line x1="10" y1="14" x2="21" y2="3" />
+ </svg>
+);
+
+export const ImageIcon = (props: IconProps) => (
+ <svg
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ strokeWidth={2}
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ {...props}>
+ <rect x="3" y="3" width="18" height="18" rx="2" ry="2" />
+ <circle cx="8.5" cy="8.5" r="1.5" />
+ <polyline points="21 15 16 10 5 21" />
+ </svg>
+);
+
+export const HomeIcon = (props: IconProps) => (
+ <svg
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ strokeWidth={2}
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ {...props}>
+ <path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" />
+ <polyline points="9 22 9 12 15 12 15 22" />
+ </svg>
+);
diff --git a/apps/sandbox/src/app/sandboxPages.ts b/apps/sandbox/src/app/sandboxPages.ts
new file mode 100644
index 0000000000..82136ffeeb
--- /dev/null
+++ b/apps/sandbox/src/app/sandboxPages.ts
@@ -0,0 +1,93 @@
+/**
+ * @file sandboxPages.ts
+ * @position Central registry of all sandbox pages, grouped by category.
+ *
+ * To add a new page:
+ * 1. Create the page under the appropriate route group:
+ * - `src/app/(sandbox)/pages/<name>/page.tsx` for standard layout
+ * - `src/app/(fullscreen)/pages/<name>/page.tsx` for fullscreen
+ * 2. Run `node scripts/capture-previews.mjs` to generate a screenshot
+ * 3. Add an entry to the appropriate category below
+ *
+ * Note: hrefs use trailing slashes because the sandbox is a static export
+ * with `trailingSlash: true` in next.config.mjs.
+ */
+
+export interface SandboxPage {
+ /** Display name shown on the card */
+ name: string;
+ /** Route path (with trailing slash) */
+ href: string;
+ /** Short description shown below the name */
+ description: string;
+ /** Path to preview image in /public (optional — falls back to placeholder) */
+ preview?: string;
+}
+
+export interface SandboxCategory {
+ /** Category label shown in the sidebar and page header */
+ label: string;
+ /** URL-friendly slug used for routing */
+ slug: string;
+ /** Short description of the category */
+ description: string;
+ /** Pages in this category */
+ pages: SandboxPage[];
+}
+
+export const categories: SandboxCategory[] = [
+ {
+ label: 'Tools',
+ slug: 'tools',
+ description: 'Interactive tools for building and exploring XDS components.',
+ pages: [
+ {
+ name: 'Theme Editor',
+ href: '/pages/theme-editor/',
+ description: 'Customize and preview XDS design tokens',
+ },
+ {
+ name: 'Shell Lab',
+ href: '/pages/shell-lab/',
+ description: 'Experiment with app shell layouts and navigation',
+ },
+ {
+ name: 'Table Overview',
+ href: '/pages/table-overview/',
+ description: 'Data table patterns and configurations',
+ },
+ ],
+ },
+ {
+ label: 'Templates',
+ slug: 'templates',
+ description: 'Ready-to-use page templates and composition patterns.',
+ pages: [
+ {
+ name: 'Navigation',
+ href: '/pages/navigation/',
+ description: 'Side navigation layout patterns',
+ },
+ {
+ name: 'TopNav Menu',
+ href: '/pages/topnav-menu/',
+ description: 'Top navigation bar with menu integration',
+ },
+ {
+ name: 'Mega Menu',
+ href: '/pages/mega-menu/',
+ description: 'Full-width dropdown navigation menu',
+ },
+ {
+ name: 'Polymorphic Link',
+ href: '/pages/polymorphic-link/',
+ description: 'Flexible link component with router integration',
+ },
+ {
+ name: 'Example',
+ href: '/pages/example/',
+ description: 'General component composition examples',
+ },
+ ],
+ },
+];