Skip to content

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

TypeScript

feat(docsite): restructure navigation and routes for external docsite (#2332)

Cindy Zhang7ee4e279a719
diff --git a/apps/docsite/src/app/(docs)/components/page.tsx b/apps/docsite/src/app/(docs)/components/page.tsx
new file mode 100644
index 0000000000..0059525ff6
--- /dev/null
+++ b/apps/docsite/src/app/(docs)/components/page.tsx
@@ -0,0 +1,119 @@
+// Copyright (c) Meta Platforms, Inc. and affiliates.
+
+/**
+ * Components gallery index — browse all showcases.
+ */
+
+'use client';
+
+import {useMemo} from 'react';
+import * as stylex from '@stylexjs/stylex';
+import {XDSText} from '@xds/core/Text';
+import {XDSVStack, XDSHStack} from '@xds/core/Layout';
+import {XDSSection} from '@xds/core/Section';
+import {XDSGrid} from '@xds/core/Grid';
+import {XDSCard} from '@xds/core/Card';
+import {XDSButton} from '@xds/core/Button';
+import {XDSOverlay} from '@xds/core/Overlay';
+import {blocks} from '../../../generated/blockRegistry';
+import {ShowcaseThumbnail} from '../../../components/ShowcaseThumbnail';
+
+const showcases = blocks.filter(b => b.isShowcase);
+
+const styles = stylex.create({
+ heroTitle: {
+ textAlign: 'center' as const,
+ },
+ cardImage: {
+ display: 'block',
+ width: '100%',
+ aspectRatio: '16/10',
+ backgroundColor: 'var(--color-background-muted)',
+ borderRadius: 'var(--radius-container)',
+ },
+ overlayInner: {
+ display: 'flex',
+ flexDirection: 'column' as const,
+ justifyContent: 'flex-end',
+ alignItems: 'flex-start',
+ height: '100%',
+ width: '100%',
+ padding: 8,
+ },
+});
+
+export default function ComponentsGalleryPage() {
+ const items = useMemo(
+ () =>
+ showcases.map(b => ({
+ name: b.name,
+ description: b.description,
+ slug: b.dirName,
+ category: b.category,
+ href: `/components/${b.componentsUsed[0] || b.category.split('/').pop()}`,
+ })),
+ [],
+ );
+
+ return (
+ <XDSSection maxWidth="xl" padding={6}>
+ <XDSVStack gap={6}>
+ <XDSVStack gap={2} style={{alignItems: 'center'}}>
+ <XDSText type="display-2" xstyle={styles.heroTitle}>
+ Components
+ </XDSText>
+ <XDSText type="body" color="secondary" xstyle={styles.heroTitle}>
+ Explore real-world component showcases and examples.
+ </XDSText>
+ </XDSVStack>
+
+ <XDSGrid columns={{minWidth: 300, repeat: 'fill'}} gap={4} rowGap={6}>
+ {items.map(item => (
+ <XDSCard key={item.slug} padding={0}>
+ <XDSOverlay
+ showOn="hover"
+ scrim="dark"
+ content={
+ <div {...stylex.props(styles.overlayInner)}>
+ <XDSVStack gap={2}>
+ <XDSVStack gap={0.5}>
+ <XDSText
+ type="body"
+ weight="bold"
+ style={{color: '#fff'}}>
+ {item.name}
+ </XDSText>
+ <XDSText
+ type="supporting"
+ style={{color: 'rgba(255,255,255,0.7)'}}>
+ {item.description.slice(0, 80)}
+ {item.description.length > 80 ? '\u2026' : ''}
+ </XDSText>
+ </XDSVStack>
+ <XDSHStack gap={2}>
+ <XDSButton
+ label="View"
+ variant="secondary"
+ size="sm"
+ href={item.href}
+ />
+ </XDSHStack>
+ </XDSVStack>
+ </div>
+ }>
+ {item.category ? (
+ <ShowcaseThumbnail
+ dirName={item.slug}
+ category={item.category}
+ />
+ ) : (
+ <div {...stylex.props(styles.cardImage)} />
+ )}
+ </XDSOverlay>
+ </XDSCard>
+ ))}
+ </XDSGrid>
+ </XDSVStack>
+ </XDSSection>
+ );
+}
diff --git a/apps/docsite/src/app/(docs)/page.tsx b/apps/docsite/src/app/(docs)/docs/page.tsx
similarity index 87%
rename from apps/docsite/src/app/(docs)/page.tsx
rename to apps/docsite/src/app/(docs)/docs/page.tsx
index 06e371120c..4c97ffa5d0 100644
--- a/apps/docsite/src/app/(docs)/page.tsx
+++ b/apps/docsite/src/app/(docs)/docs/page.tsx
@@ -14,14 +14,12 @@ import {XDSGrid} from '@xds/core/Grid';
import {XDSSection} from '@xds/core/Section';
import {XDSButton} from '@xds/core/Button';
import {XDSTheme, XDSMediaTheme} from '@xds/core/theme';
-import {XDSDivider} from '@xds/core/Divider';
import {XDSLink} from '@xds/core/Link';
-import {spacingVars} from '@xds/core/theme/tokens.stylex';
-import {packages} from '../../generated/packageRegistry';
-import {componentCount} from '../../generated/componentRegistry';
-import {docTopics} from '../../generated/docsRegistry';
-import {ThemeShowcaseTile} from '../../components/ThemeShowcaseTile';
-import {themeObjects} from '../../generated/themeRegistry';
+import {packages} from '../../../generated/packageRegistry';
+import {componentCount} from '../../../generated/componentRegistry';
+import {docTopics} from '../../../generated/docsRegistry';
+import {ThemeShowcaseTile} from '../../../components/ThemeShowcaseTile';
+import {themeObjects} from '../../../generated/themeRegistry';
const TerminalIcon = (props: React.SVGProps<SVGSVGElement>) => (
<svg
@@ -159,17 +157,6 @@ const styles = stylex.create({
color: 'inherit',
cursor: 'pointer',
},
- footerDivider: {
- paddingBlockStart: spacingVars['--spacing-12'],
- },
- footer: {
- paddingBlockStart: spacingVars['--spacing-12'],
- paddingBlockEnd: spacingVars['--spacing-12'],
- display: 'flex',
- flexDirection: 'column',
- alignItems: 'center',
- gap: spacingVars['--spacing-2'],
- },
});
const foundationTopics = docTopics
@@ -339,27 +326,6 @@ export default function HomePage() {
</XDSVStack>
</XDSVStack>
</XDSSection>
-
- <XDSDivider xstyle={styles.footerDivider} />
- <footer {...stylex.props(styles.footer)}>
- <XDSText type="supporting" color="secondary">
- <XDSLink
- color="secondary"
- label="Terms of Use"
- href="https://opensource.fb.com/legal/terms"
- isExternalLink>
- Terms of Use
- </XDSLink>
- {' | '}
- <XDSLink
- color="secondary"
- label="Privacy Policy"
- href="https://opensource.fb.com/legal/privacy"
- isExternalLink>
- Privacy Policy
- </XDSLink>
- </XDSText>
- </footer>
</div>
);
}
diff --git a/apps/docsite/src/app/(docs)/layout.tsx b/apps/docsite/src/app/(docs)/layout.tsx
index 8848fa865b..512a0780b7 100644
--- a/apps/docsite/src/app/(docs)/layout.tsx
+++ b/apps/docsite/src/app/(docs)/layout.tsx
@@ -2,6 +2,7 @@
import {headers} from 'next/headers';
import {DocsShell} from '../../components/DocsShell';
+import {SiteFooter} from '../../components/SiteFooter';
import {components} from '../../generated/componentRegistry';
import {packages} from '../../generated/packageRegistry';
import {docTopics} from '../../generated/docsRegistry';
@@ -24,6 +25,7 @@ export default async function DocsLayout({
templates={templates}
defaultIsMobile={defaultIsMobile}>
{children}
+ <SiteFooter />
</DocsShell>
);
}
diff --git a/apps/docsite/src/app/(marketing)/community/page.tsx b/apps/docsite/src/app/(marketing)/community/page.tsx
new file mode 100644
index 0000000000..f6c598a997
--- /dev/null
+++ b/apps/docsite/src/app/(marketing)/community/page.tsx
@@ -0,0 +1,205 @@
+// Copyright (c) Meta Platforms, Inc. and affiliates.
+
+/**
+ * Community page — contribution guidance + live GitHub contributors.
+ */
+
+import {XDSHeading, XDSText} from '@xds/core/Text';
+import {XDSVStack} from '@xds/core/Layout';
+import {XDSSection} from '@xds/core/Section';
+import {XDSGrid} from '@xds/core/Grid';
+import {XDSCard} from '@xds/core/Card';
+import {XDSLink} from '@xds/core/Link';
+import {XDSDivider} from '@xds/core/Divider';
+import * as stylex from '@stylexjs/stylex';
+import {GITHUB_REPO} from '../../../constants';
+
+const styles = stylex.create({
+ avatar: {
+ width: 48,
+ height: 48,
+ borderRadius: '50%',
+ objectFit: 'cover' as const,
+ },
+ contributorCard: {
+ display: 'flex',
+ alignItems: 'center',
+ gap: 12,
+ },
+ badge: {
+ fontSize: 12,
+ fontWeight: 600,
+ backgroundColor: 'var(--color-background-muted)',
+ borderRadius: 12,
+ paddingInline: 8,
+ paddingBlock: 2,
+ },
+});
+
+interface Contributor {
+ login: string;
+ avatar_url: string;
+ contributions: number;
+ html_url: string;
+}
+
+async function fetchContributors(): Promise<Contributor[]> {
+ try {
+ const res = await fetch(
+ 'https://api.github.com/repos/facebookexperimental/xds/contributors?per_page=50',
+ {next: {revalidate: 3600}},
+ );
+ if (!res.ok) {
+ return [];
+ }
+ return res.json();
+ } catch {
+ return [];
+ }
+}
+
+export default async function CommunityPage() {
+ const contributors = await fetchContributors();
+
+ return (
+ <XDSSection maxWidth="lg" padding={6}>
+ <XDSVStack gap={8}>
+ {/* Welcome */}
+ <XDSVStack gap={3}>
+ <XDSHeading level={1}>Community</XDSHeading>
+ <XDSText type="large" color="secondary">
+ XDS is built in the open. We welcome contributions of all
+ kinds—whether it&apos;s fixing a typo, proposing a new component, or
+ improving documentation.
+ </XDSText>
+ </XDSVStack>
+
+ {/* Links */}
+ <XDSVStack gap={3}>
+ <XDSHeading level={2}>Get Involved</XDSHeading>
+ <XDSGrid columns={{minWidth: 250, repeat: 'fill'}} gap={3}>
+ <XDSCard padding={4}>
+ <XDSVStack gap={1}>
+ <XDSText type="body" weight="bold">
+ Contribution Guide
+ </XDSText>
+ <XDSText type="supporting" color="secondary">
+ Learn how to set up the repo, write components, and submit
+ pull requests.
+ </XDSText>
+ <XDSLink
+ label="Read the guide"
+ href={`${GITHUB_REPO}/blob/main/CONTRIBUTING.md`}
+ isExternalLink>
+ Read the guide
+ </XDSLink>
+ </XDSVStack>
+ </XDSCard>
+ <XDSCard padding={4}>
+ <XDSVStack gap={1}>
+ <XDSText type="body" weight="bold">
+ Code of Conduct
+ </XDSText>
+ <XDSText type="supporting" color="secondary">
+ Our community standards and expectations for respectful
+ collaboration.
+ </XDSText>
+ <XDSLink
+ label="View code of conduct"
+ href={`${GITHUB_REPO}/blob/main/CODE_OF_CONDUCT.md`}
+ isExternalLink>
+ View code of conduct
+ </XDSLink>
+ </XDSVStack>
+ </XDSCard>
+ <XDSCard padding={4}>
+ <XDSVStack gap={1}>
+ <XDSText type="body" weight="bold">
+ License
+ </XDSText>
+ <XDSText type="supporting" color="secondary">
+ XDS is released under the MIT License.
+ </XDSText>
+ <XDSLink
+ label="View license"
+ href={`${GITHUB_REPO}/blob/main/LICENSE`}
+ isExternalLink>
+ View license
+ </XDSLink>
+ </XDSVStack>
+ </XDSCard>
+ <XDSCard padding={4}>
+ <XDSVStack gap={1}>
+ <XDSText type="body" weight="bold">
+ Issues &amp; Discussions
+ </XDSText>
+ <XDSText type="supporting" color="secondary">
+ Report bugs, request features, or ask questions on GitHub.
+ </XDSText>
+ <XDSLink
+ label="Open an issue"
+ href={`${GITHUB_REPO}/issues`}
+ isExternalLink>
+ Open an issue
+ </XDSLink>
+ </XDSVStack>
+ </XDSCard>
+ </XDSGrid>
+ </XDSVStack>
+
+ <XDSDivider />
+
+ {/* Contributors */}
+ <XDSVStack gap={3}>
+ <XDSVStack gap={1}>
+ <XDSHeading level={2}>Contributors</XDSHeading>
+ <XDSText type="body" color="secondary">
+ Thank you to everyone who has contributed to XDS. Sorted by number
+ of contributions.
+ </XDSText>
+ </XDSVStack>
+
+ {contributors.length > 0 ? (
+ <XDSGrid columns={{minWidth: 280, repeat: 'fill'}} gap={3}>
+ {contributors.map(c => (
+ <XDSLink
+ key={c.login}
+ href={c.html_url}
+ isExternalLink
+ label={c.login}>
+ <div {...stylex.props(styles.contributorCard)}>
+ <img
+ src={c.avatar_url}
+ alt={c.login}
+ {...stylex.props(styles.avatar)}
+ />
+ <XDSVStack gap={0}>
+ <XDSText type="body" weight="semibold">
+ {c.login}
+ </XDSText>
+ <XDSText type="supporting" color="secondary">
+ {c.contributions} contribution
+ {c.contributions !== 1 ? 's' : ''}
+ </XDSText>
+ </XDSVStack>
+ </div>
+ </XDSLink>
+ ))}
+ </XDSGrid>
+ ) : (
+ <XDSText type="body" color="secondary">
+ Unable to load contributors. Check back later or view them on{' '}
+ <XDSLink
+ label="GitHub"
+ href={`${GITHUB_REPO}/graphs/contributors`}
+ isExternalLink>
+ GitHub
+ </XDSLink>
+ .
+ </XDSText>
+ )}
+ </XDSVStack>
+ </XDSVStack>
+ </XDSSection>
+ );
+}
diff --git a/apps/docsite/src/app/craft/layout.tsx b/apps/docsite/src/app/(marketing)/layout.tsx
similarity index 82%
rename from apps/docsite/src/app/craft/layout.tsx
rename to apps/docsite/src/app/(marketing)/layout.tsx
index 5dc5588be3..991a08ff8a 100644
--- a/apps/docsite/src/app/craft/layout.tsx
+++ b/apps/docsite/src/app/(marketing)/layout.tsx
@@ -3,8 +3,9 @@
import {headers} from 'next/headers';
import {XDSAppShell} from '@xds/core/AppShell';
import {SharedTopNav} from '../../components/SharedTopNav';
+import {SiteFooter} from '../../components/SiteFooter';
-export default async function CraftLayout({
+export default async function MarketingLayout({
children,
}: {
children: React.ReactNode;
@@ -20,6 +21,7 @@ export default async function CraftLayout({
mobileNav={{defaultIsMobile}}
topNav={<SharedTopNav />}>
{children}
+ <SiteFooter />
</XDSAppShell>
);
}
diff --git a/apps/docsite/src/app/(marketing)/page.tsx b/apps/docsite/src/app/(marketing)/page.tsx
new file mode 100644
index 0000000000..15a20cf13b
--- /dev/null
+++ b/apps/docsite/src/app/(marketing)/page.tsx
@@ -0,0 +1,56 @@
+// Copyright (c) Meta Platforms, Inc. and affiliates.
+
+import * as stylex from '@stylexjs/stylex';
+import {XDSText} from '@xds/core/Text';
+import {XDSVStack} from '@xds/core/Layout';
+import {XDSButton} from '@xds/core/Button';
+import {XDSMediaTheme} from '@xds/core/theme';
+
+const styles = stylex.create({
+ hero: {
+ minHeight: 'calc(100vh - 64px)',
+ display: 'flex',
+ flexDirection: 'column',
+ alignItems: 'center',
+ justifyContent: 'center',
+ textAlign: 'center',
+ padding: 48,
+ },
+ subtitle: {
+ maxWidth: 560,
+ marginTop: 8,
+ },
+ buttons: {
+ marginTop: 32,
+ display: 'flex',
+ gap: 12,
+ },
+});
+
+export default function HomePage() {
+ return (
+ <div {...stylex.props(styles.hero)}>
+ <XDSMediaTheme mode="light">
+ <XDSVStack gap={2} style={{alignItems: 'center'}}>
+ <XDSText type="display-1">XDS Open Source</XDSText>
+ <XDSText type="large" color="secondary" xstyle={styles.subtitle}>
+ An open design system for building internal tools with AI-powered
+ development.
+ </XDSText>
+ <div {...stylex.props(styles.buttons)}>
+ <XDSButton
+ variant="primary"
+ label="Get started"
+ href="/docs/getting-started"
+ />
+ <XDSButton
+ variant="secondary"
+ label="Browse components"
+ href="/components"
+ />
+ </div>
+ </XDSVStack>
+ </XDSMediaTheme>
+ </div>
+ );
+}
diff --git a/apps/docsite/src/app/craft/templates/[slug]/page.tsx b/apps/docsite/src/app/(marketing)/templates/[slug]/page.tsx
similarity index 100%
rename from apps/docsite/src/app/craft/templates/[slug]/page.tsx
rename to apps/docsite/src/app/(marketing)/templates/[slug]/page.tsx
diff --git a/apps/docsite/src/app/(marketing)/templates/page.tsx b/apps/docsite/src/app/(marketing)/templates/page.tsx
new file mode 100644
index 0000000000..8a70de558c
--- /dev/null
+++ b/apps/docsite/src/app/(marketing)/templates/page.tsx
@@ -0,0 +1,131 @@
+// Copyright (c) Meta Platforms, Inc. and affiliates.
+
+/**
+ * Templates gallery — extracted from craft.
+ */
+
+'use client';
+
+import {useMemo} from 'react';
+import * as stylex from '@stylexjs/stylex';
+import {XDSText} from '@xds/core/Text';
+import {XDSVStack, XDSHStack} from '@xds/core/Layout';
+import {XDSSection} from '@xds/core/Section';
+import {XDSGrid} from '@xds/core/Grid';
+import {XDSCard} from '@xds/core/Card';
+import {XDSButton} from '@xds/core/Button';
+import {XDSOverlay} from '@xds/core/Overlay';
+import {XDSBadge} from '@xds/core/Badge';
+import {templates} from '../../../generated/templateRegistry';
+import {TemplateThumbnail} from '../../../components/TemplateThumbnail';
+
+const styles = stylex.create({
+ heroTitle: {
+ textAlign: 'center' as const,
+ },
+ cardImage: {
+ display: 'block',
+ width: '100%',
+ aspectRatio: '16/10',
+ backgroundColor: 'var(--color-background-muted)',
+ borderRadius: 'var(--radius-container)',
+ },
+ comingSoon: {
+ height: '100%',
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ },
+ overlayInner: {
+ display: 'flex',
+ flexDirection: 'column' as const,
+ justifyContent: 'flex-end',
+ alignItems: 'flex-start',
+ height: '100%',
+ width: '100%',
+ padding: 8,
+ },
+});
+
+export default function TemplatesPage() {
+ const items = useMemo(
+ () =>
+ templates.map(t => ({
+ name: t.name,
+ description: t.description,
+ slug: t.slug,
+ href: `/templates/${t.slug}`,
+ isReady: t.isReady,
+ })),
+ [],
+ );
+
+ return (
+ <XDSSection maxWidth="xl" padding={6}>
+ <XDSVStack gap={6}>
+ <XDSVStack gap={2} style={{alignItems: 'center'}}>
+ <XDSText type="display-2" xstyle={styles.heroTitle}>
+ Templates
+ </XDSText>
+ <XDSText type="body" color="secondary" xstyle={styles.heroTitle}>
+ Ready-to-use page templates to kickstart your project.
+ </XDSText>
+ </XDSVStack>
+
+ <XDSGrid columns={{minWidth: 300, repeat: 'fill'}} gap={4} rowGap={6}>
+ {items.map(item => (
+ <XDSCard key={item.slug} padding={0}>
+ <XDSOverlay
+ showOn="hover"
+ scrim="dark"
+ content={
+ <div {...stylex.props(styles.overlayInner)}>
+ <XDSVStack gap={2}>
+ <XDSVStack gap={0.5}>
+ <XDSText
+ type="body"
+ weight="bold"
+ style={{color: '#fff'}}>
+ {item.name}
+ </XDSText>
+ <XDSText
+ type="supporting"
+ style={{color: 'rgba(255,255,255,0.7)'}}>
+ {item.description.slice(0, 80)}
+ {item.description.length > 80 ? '\u2026' : ''}
+ </XDSText>
+ </XDSVStack>
+ <XDSHStack gap={2}>
+ <XDSButton
+ label="Preview"
+ variant="secondary"
+ size="sm"
+ href={item.href}
+ />
+ <XDSButton
+ label="Use"
+ variant="secondary"
+ size="sm"
+ href={item.href}
+ />
+ </XDSHStack>
+ </XDSVStack>
+ </div>
+ }>
+ {item.isReady ? (
+ <TemplateThumbnail slug={item.slug} />
+ ) : (
+ <div {...stylex.props(styles.cardImage)}>
+ <div {...stylex.props(styles.comingSoon)}>
+ <XDSBadge label="Coming Soon" variant="info" />
+ </div>
+ </div>
+ )}
+ </XDSOverlay>
+ </XDSCard>
+ ))}
+ </XDSGrid>
+ </XDSVStack>
+ </XDSSection>
+ );
+}
diff --git a/apps/docsite/src/app/craft/theme/page.tsx b/apps/docsite/src/app/(marketing)/themes/editor/page.tsx
similarity index 100%
rename from apps/docsite/src/app/craft/theme/page.tsx
rename to apps/docsite/src/app/(marketing)/themes/editor/page.tsx
diff --git a/apps/docsite/src/app/(marketing)/themes/page.tsx b/apps/docsite/src/app/(marketing)/themes/page.tsx
new file mode 100644
index 0000000000..03e0ca4c7e
--- /dev/null
+++ b/apps/docsite/src/app/(marketing)/themes/page.tsx
@@ -0,0 +1,121 @@
+// Copyright (c) Meta Platforms, Inc. and affiliates.
+
+/**
+ * Themes gallery — extracted from craft.
+ */
+
+// Copyright (c) Meta Platforms, Inc. and affiliates.
+
+'use client';
+
+import * as stylex from '@stylexjs/stylex';
+import {XDSText} from '@xds/core/Text';
+import {XDSVStack, XDSHStack} from '@xds/core/Layout';
+import {XDSSection} from '@xds/core/Section';
+import {XDSGrid} from '@xds/core/Grid';
+import {XDSCard} from '@xds/core/Card';
+import {XDSButton} from '@xds/core/Button';
+import {XDSOverlay} from '@xds/core/Overlay';
+import {XDSTheme} from '@xds/core/theme';
+import {packages} from '../../../generated/packageRegistry';
+import {themeObjects} from '../../../generated/themeRegistry';
+import {ThemeShowcaseTile} from '../../../components/ThemeShowcaseTile';
+
+const themePackages = packages.filter(p => p.name.includes('theme-'));
+
+const styles = stylex.create({
+ heroTitle: {
+ textAlign: 'center' as const,
+ },
+ cardImage: {
+ display: 'block',
+ width: '100%',
+ aspectRatio: '16/10',
+ backgroundColor: 'var(--color-background-muted)',
+ borderRadius: 'var(--radius-container)',
+ },
+ overlayInner: {
+ display: 'flex',
+ flexDirection: 'column' as const,
+ justifyContent: 'flex-end',
+ alignItems: 'flex-start',
+ height: '100%',
+ width: '100%',
+ padding: 8,
+ },
+});
+
+export default function ThemesPage() {
+ return (
+ <XDSSection maxWidth="xl" padding={6}>
+ <XDSVStack gap={6}>
+ <XDSVStack gap={2} style={{alignItems: 'center'}}>
+ <XDSText type="display-2" xstyle={styles.heroTitle}>
+ Themes
+ </XDSText>
+ <XDSText type="body" color="secondary" xstyle={styles.heroTitle}>
+ Swap the visual identity of your app with a single theme package.
+ </XDSText>
+ </XDSVStack>
+
+ <XDSGrid columns={{minWidth: 300, repeat: 'fill'}} gap={4} rowGap={6}>
+ {themePackages.map(pkg => {
+ const theme = themeObjects[pkg.name];
+ const label = pkg.displayName.replace('Theme: ', '');
+ return (
+ <XDSCard key={pkg.name} padding={0}>
+ <XDSOverlay
+ showOn="hover"
+ scrim="dark"
+ content={
+ <div {...stylex.props(styles.overlayInner)}>
+ <XDSVStack gap={2}>
+ <XDSVStack gap={0.5}>
+ <XDSText
+ type="body"
+ weight="bold"
+ style={{color: '#fff'}}>
+ {pkg.displayName}
+ </XDSText>
+ <XDSText
+ type="supporting"
+ style={{color: 'rgba(255,255,255,0.7)'}}>
+ {pkg.description.slice(0, 80)}
+ {pkg.description.length > 80 ? '\u2026' : ''}
+ </XDSText>
+ </XDSVStack>
+ <XDSHStack gap={2}>
+ <XDSButton
+ label="View theme"
+ variant="secondary"
+ size="sm"
+ href={`/packages/${pkg.name.replace('@xds/', '')}`}
+ />
+ <XDSButton
+ label="Customize"
+ variant="secondary"
+ size="sm"
+ href="/themes/editor"
+ />
+ </XDSHStack>
+ </XDSVStack>
+ </div>
+ }>
+ <div style={{aspectRatio: '16/10'}} inert>
+ {theme ? (
+ <XDSTheme theme={theme}>
+ <ThemeShowcaseTile label={label} />
+ </XDSTheme>
+ ) : (
+ <div {...stylex.props(styles.cardImage)} />
+ )}
+ </div>
+ </XDSOverlay>
+ </XDSCard>
+ );
+ })}
+ </XDSGrid>
+ </XDSVStack>
+ </XDSSection>
+ );
+}
diff --git a/apps/docsite/src/app/craft/page.tsx b/apps/docsite/src/app/craft/page.tsx
deleted file mode 100644
index 398bb86ecd..0000000000
--- a/apps/docsite/src/app/craft/page.tsx
+++ /dev/null
@@ -1,275 +0,0 @@
-// Copyright (c) Meta Platforms, Inc. and affiliates.
-
-/**
- * Page type: craft landing
- * Template gallery with hover overlay cards.
- * All data from pipeline registries.
- */
-
-'use client';
-
-import {useState, useMemo} from 'react';
-import * as stylex from '@stylexjs/stylex';
-import {XDSText} from '@xds/core/Text';
-import {XDSVStack, XDSHStack} from '@xds/core/Layout';
-import {XDSSection} from '@xds/core/Section';
-import {XDSGrid} from '@xds/core/Grid';
-import {XDSCard} from '@xds/core/Card';
-import {XDSButton} from '@xds/core/Button';
-import {XDSOverlay} from '@xds/core/Overlay';
-import {XDSTabList, XDSTab} from '@xds/core/TabList';
-import {XDSCarousel} from '@xds/core/Carousel';
-import {XDSBadge} from '@xds/core/Badge';
-import {templates} from '../../generated/templateRegistry';
-import {ThemeShowcaseTile} from '../../components/ThemeShowcaseTile';
-import {XDSTheme} from '@xds/core/theme';
-import {themeObjects} from '../../generated/themeRegistry';
-import {TemplateThumbnail} from '../../components/TemplateThumbnail';
-import {ShowcaseThumbnail} from '../../components/ShowcaseThumbnail';
-import {blocks} from '../../generated/blockRegistry';
-import {packages} from '../../generated/packageRegistry';
-
-const showcases = blocks.filter(b => b.isShowcase);
-const themePackages = packages.filter(p => p.name.includes('theme-'));
-
-const styles = stylex.create({
- heroTitle: {
- textAlign: 'center' as const,
- },
- carouselTabs: {
- marginBottom: 4,
- },
- cardImage: {
- display: 'block',
- width: '100%',
- aspectRatio: '16/10',
- backgroundColor: 'var(--color-background-muted)',
- borderRadius: 'var(--radius-container)',
- },
- comingSoon: {
- height: '100%',
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- },
- overlayInner: {
- display: 'flex',
- flexDirection: 'column' as const,
- justifyContent: 'flex-end',
- alignItems: 'flex-start',
- height: '100%',
- width: '100%',
- padding: 8,
- },
-});
-
-type Tab = 'all' | 'templates' | 'theme' | 'showcases';
-
-interface CraftItem {
- type: 'template' | 'showcase';
- name: string;
- description: string;
- slug: string;
- category?: string;
- href: string;
- isReady: boolean;
-}
-
-function buildItems(): {templates: CraftItem[]; showcases: CraftItem[]} {
- return {
- templates: templates.map(t => ({
- type: 'template' as const,
- name: t.name,
- description: t.description,
- slug: t.slug,
- href: `/craft/templates/${t.slug}`,
- isReady: t.isReady,
- })),
- showcases: showcases.map(b => ({
- type: 'showcase' as const,
- name: b.name,
- description: b.description,
- slug: b.dirName,
- category: b.category,
- href: `/components/${b.componentsUsed[0] || b.category.split('/').pop()}`,
- isReady: true,
- })),
- };
-}
-
-export default function CraftPage() {
- const [activeTab, setActiveTab] = useState<Tab>('all');
- const allItems = useMemo(buildItems, []);
-
- const handleTabChange = (v: string) => {
- setActiveTab(v as Tab);
- };
-
- const items =
- activeTab === 'templates'
- ? allItems.templates
- : activeTab === 'showcases'
- ? allItems.showcases
- : [...allItems.templates, ...allItems.showcases];
-
- return (
- <XDSSection maxWidth="xl" padding={6}>
- <XDSVStack gap={6}>
- <XDSText type="display-1" xstyle={styles.heroTitle}>
- Craft what you imagine.
- </XDSText>
-
- <XDSCarousel gap={0}>
- <XDSTabList
- value={activeTab}
- onChange={handleTabChange}
- size="md"
- xstyle={styles.carouselTabs}>
- <XDSTab
- value="all"
- label={`All (${allItems.templates.length + allItems.showcases.length})`}
- />
- <XDSTab
- value="templates"
- label={`Templates (${allItems.templates.length})`}
- />
- <XDSTab value="theme" label={`Theme (${themePackages.length})`} />
- <XDSTab
- value="showcases"
- label={`Components (${allItems.showcases.length})`}
- />
- </XDSTabList>
- </XDSCarousel>
-
- {activeTab === 'theme' ? (
- <ThemeGrid />
- ) : (
- <XDSGrid columns={{minWidth: 300, repeat: 'fill'}} gap={4} rowGap={6}>
- {items.map(item => (
- <TemplateCard key={`${item.type}-${item.slug}`} item={item} />
- ))}
- </XDSGrid>
- )}
- </XDSVStack>
- </XDSSection>
- );
-}
-
-function ThemeGrid() {
- return (
- <XDSGrid columns={{minWidth: 300, repeat: 'fill'}} gap={4} rowGap={6}>
- {themePackages.map(pkg => {
- const theme = themeObjects[pkg.name];
- const label = pkg.displayName.replace('Theme: ', '');
- return (
- <XDSCard key={pkg.name} padding={0}>
- <XDSOverlay
- showOn="hover"
- scrim="dark"
- content={
- <div {...stylex.props(styles.overlayInner)}>
- <XDSVStack gap={2}>
- <XDSVStack gap={0.5}>
- <XDSText
- type="body"
- weight="bold"
- style={{color: '#fff'}}>
- {pkg.displayName}
- </XDSText>
- <XDSText
- type="supporting"
- style={{color: 'rgba(255,255,255,0.7)'}}>
- {pkg.description.slice(0, 80)}
- {pkg.description.length > 80 ? '\u2026' : ''}
- </XDSText>
- </XDSVStack>
- <XDSHStack gap={2}>
- <XDSButton
- label="View theme"
- variant="secondary"
- size="sm"
- href={`/packages/${pkg.name.replace('@xds/', '')}`}
- />
- <XDSButton
- label="Customize"
- variant="secondary"
- size="sm"
- href="/craft/theme"
- />
- </XDSHStack>
- </XDSVStack>
- </div>
- }>
- <div style={{aspectRatio: '16/10'}} inert>
- {theme ? (
- <XDSTheme theme={theme}>
- <ThemeShowcaseTile label={label} />
- </XDSTheme>
- ) : (
- <div {...stylex.props(styles.cardImage)} />
- )}
- </div>
- </XDSOverlay>
- </XDSCard>
- );
- })}
- </XDSGrid>
- );
-}
-
-function TemplateCard({item}: {item: CraftItem}) {
- return (
- <XDSCard padding={0}>
- <XDSOverlay
- showOn="hover"
- scrim="dark"
- content={
- <div {...stylex.props(styles.overlayInner)}>
- <XDSVStack gap={2}>
- <XDSVStack gap={0.5}>
- <XDSText type="body" weight="bold" style={{color: '#fff'}}>
- {item.name}
- </XDSText>
- <XDSText
- type="supporting"
- style={{color: 'rgba(255,255,255,0.7)'}}>
- {item.description.slice(0, 80)}
- {item.description.length > 80 ? '…' : ''}
- </XDSText>
- </XDSVStack>
- <XDSHStack gap={2}>
- <XDSButton
- label="Preview"
- variant="secondary"
- size="sm"
- href={item.href}
- />
- {item.type === 'template' && (
- <XDSButton
- label="Use"
- variant="secondary"
- size="sm"
- href={item.href}
- />
- )}
- </XDSHStack>
- </XDSVStack>
- </div>
- }>
- {item.type === 'template' && item.isReady ? (
- <TemplateThumbnail slug={item.slug} />
- ) : item.type === 'showcase' && item.category ? (
- <ShowcaseThumbnail dirName={item.slug} category={item.category} />
- ) : (
- <div {...stylex.props(styles.cardImage)}>
- {!item.isReady && (
- <div {...stylex.props(styles.comingSoon)}>
- <XDSBadge label="Coming Soon" variant="info" />
- </div>
- )}
- </div>
- )}
- </XDSOverlay>
- </XDSCard>
- );
-}
diff --git a/apps/docsite/src/components/DocsShell.tsx b/apps/docsite/src/components/DocsShell.tsx
index 1811c1095f..5fe3111794 100644
--- a/apps/docsite/src/components/DocsShell.tsx
+++ b/apps/docsite/src/components/DocsShell.tsx
@@ -4,10 +4,8 @@
import {usePathname} from 'next/navigation';
import {XDSAppShell} from '@xds/core/AppShell';
-import {XDSCenter} from '@xds/core/Center';
import {XDSSideNav, XDSSideNavItem, XDSSideNavSection} from '@xds/core/SideNav';
import {SharedTopNav} from './SharedTopNav';
-import {XDSLink} from '@xds/core/Link';
import type {ComponentEntry} from '../generated/componentRegistry';
import type {PackageMeta} from '../generated/packageRegistry';
import type {DocTopic} from '../generated/docsRegistry';
@@ -103,24 +101,13 @@ export function DocsShell({
mobileNav={{defaultIsMobile}}
topNav={<SharedTopNav />}
sideNav={
- <XDSSideNav
- footer={
- <XDSCenter>
- <XDSLink
- color="secondary"
- label="GitHub Pages"
- href="https://studious-broccoli-o7e61n3.pages.github.io/"
- isExternalLink>
- GitHub Pages
- </XDSLink>
- </XDSCenter>
- }>
- {/* Home */}
- <XDSSideNavSection title="Home" isHeaderHidden>
+ <XDSSideNav>
+ {/* Documentation */}
+ <XDSSideNavSection title="Documentation" isHeaderHidden>
<XDSSideNavItem
- label="Home"
- href="/"
- isSelected={pathname === '/'}
+ label="Documentation"
+ href="/docs"
+ isSelected={pathname === '/docs'}
/>
</XDSSideNavSection>
diff --git a/apps/docsite/src/components/SharedTopNav.tsx b/apps/docsite/src/components/SharedTopNav.tsx
index 019bddd383..54fc2a98b4 100644
--- a/apps/docsite/src/components/SharedTopNav.tsx
+++ b/apps/docsite/src/components/SharedTopNav.tsx
@@ -3,11 +3,11 @@
'use client';
import {useState} from 'react';
-import {XDSTopNav, XDSTopNavHeading} from '@xds/core/TopNav';
-import {XDSNavHeadingMenu, XDSNavHeadingMenuItem} from '@xds/core/NavMenu';
+import {usePathname} from 'next/navigation';
+import {XDSTopNav, XDSTopNavHeading, XDSTopNavItem} from '@xds/core/TopNav';
import {XDSButton} from '@xds/core/Button';
import {XDSHStack} from '@xds/core/Layout';
-import {MagnifyingGlassIcon} from '@heroicons/react/24/outline';
+import {MagnifyingGlassIcon, HeartIcon} from '@heroicons/react/24/outline';
import {GITHUB_REPO} from '../constants';
import {XDS_WORDMARK} from './XDSWordmark';
import {SearchPalette} from './SearchPalette';
@@ -35,23 +35,66 @@ const GitHubIcon = ({
export function SharedTopNav() {
const [isSearchOpen, setIsSearchOpen] = useState(false);
+ const pathname = usePathname();
+
+ // Determine active nav item
+ const getActiveItem = () => {
+ if (
+ pathname === '/docs' ||
+ pathname.startsWith('/docs/') ||
+ pathname.startsWith('/packages/') ||
+ pathname.startsWith('/changelog')
+ ) {
+ return 'docs';
+ }
+ if (pathname.startsWith('/templates')) {
+ return 'templates';
+ }
+ if (pathname.startsWith('/themes')) {
+ return 'themes';
+ }
+ if (pathname.startsWith('/components')) {
+ return 'components';
+ }
+ if (pathname.startsWith('/playground')) {
+ return 'playground';
+ }
+ return undefined;
+ };
return (
<>
<XDSTopNav
label="XDS navigation"
- heading={
- <XDSTopNavHeading
- logo={XDS_WORDMARK}
- headingHref="/"
- menu={
- <XDSNavHeadingMenu size="lg">
- <XDSNavHeadingMenuItem label="Craft" href="/craft" />
- <XDSNavHeadingMenuItem label="Docs" href="/" />
- <XDSNavHeadingMenuItem label="Playground" href="/playground" />
- </XDSNavHeadingMenu>
- }
- />
+ heading={<XDSTopNavHeading logo={XDS_WORDMARK} headingHref="/" />}
+ centerContent={
+ <>
+ <XDSTopNavItem
+ label="Docs"
+ href="/docs"
+ isSelected={getActiveItem() === 'docs'}
+ />
+ <XDSTopNavItem
+ label="Templates"
+ href="/templates"
+ isSelected={getActiveItem() === 'templates'}
+ />
+ <XDSTopNavItem
+ label="Themes"
+ href="/themes"
+ isSelected={getActiveItem() === 'themes'}
+ />
+ <XDSTopNavItem
+ label="Components"
+ href="/components"
+ isSelected={getActiveItem() === 'components'}
+ />
+ <XDSTopNavItem
+ label="Playground"
+ href="/playground"
+ isSelected={getActiveItem() === 'playground'}
+ />
+ </>
}
endContent={
<XDSHStack gap={0.5}>
@@ -62,6 +105,13 @@ export function SharedTopNav() {
icon={<MagnifyingGlassIcon width={20} height={20} />}
onClick={() => setIsSearchOpen(true)}
/>
+ <XDSButton
+ label="Community"
+ variant="ghost"
+ isIconOnly
+ icon={<HeartIcon width={20} height={20} />}
+ href="/community"
+ />
<XDSButton
label="GitHub"
variant="ghost"
@@ -69,6 +119,12 @@ export function SharedTopNav() {
icon={<GitHubIcon />}
href={GITHUB_REPO}
/>
+ <XDSButton
+ label="Get started"
+ variant="primary"
+ size="sm"
+ href="/docs/getting-started"
+ />
</XDSHStack>
}
/>
diff --git a/apps/docsite/src/components/SiteFooter.tsx b/apps/docsite/src/components/SiteFooter.tsx
new file mode 100644
index 0000000000..0bacab6b6c
--- /dev/null
+++ b/apps/docsite/src/components/SiteFooter.tsx
@@ -0,0 +1,59 @@
+// Copyright (c) Meta Platforms, Inc. and affiliates.
+
+import * as stylex from '@stylexjs/stylex';
+import {XDSText} from '@xds/core/Text';
+import {XDSLink} from '@xds/core/Link';
+import {XDSDivider} from '@xds/core/Divider';
+import {spacingVars} from '@xds/core/theme/tokens.stylex';
+
+const styles = stylex.create({
+ divider: {
+ paddingBlockStart: spacingVars['--spacing-12'],
+ },
+ footer: {
+ paddingBlockStart: spacingVars['--spacing-12'],
+ paddingBlockEnd: spacingVars['--spacing-12'],
+ display: 'flex',
+ flexDirection: 'column',
+ alignItems: 'center',
+ gap: spacingVars['--spacing-2'],
+ },
+});
+
+export function SiteFooter() {
+ return (
+ <>
+ <XDSDivider xstyle={styles.divider} />
+ <footer {...stylex.props(styles.footer)}>
+ <XDSText type="supporting" color="secondary">
+ Copyright © Meta Platforms, Inc.
+ </XDSText>
+ <XDSText type="supporting" color="secondary">
+ <XDSLink
+ color="secondary"
+ label="GitHub Pages"
+ href="https://studious-broccoli-o7e61n3.pages.github.io/"
+ isExternalLink>
+ GitHub Pages
+ </XDSLink>
+ {' | '}
+ <XDSLink
+ color="secondary"
+ label="Terms of Use"
+ href="https://opensource.fb.com/legal/terms"
+ isExternalLink>
+ Terms of Use
+ </XDSLink>
+ {' | '}
+ <XDSLink
+ color="secondary"
+ label="Privacy Policy"
+ href="https://opensource.fb.com/legal/privacy"
+ isExternalLink>
+ Privacy Policy
+ </XDSLink>
+ </XDSText>
+ </footer>
+ </>
+ );
+}