Skip to content

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

TypeScript

feat(sandbox): migrate docsite template to XDS components (#1391)

Ernest055b3b078de9
diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/AIComposer.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/AIComposer.tsx
index 3be2812d84..e48ee9414c 100644
--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/AIComposer.tsx
+++ b/apps/sandbox/src/app/(fullscreen)/pages/docsite/AIComposer.tsx
@@ -1,8 +1,7 @@
'use client';
import React, {useState} from 'react';
-import {XDSButton} from '@xds/core/Button';
-import {PlusIcon, SendIcon} from './docsite-icons';
+import {XDSChatComposer, XDSChatComposerInput} from '@xds/core/Chat';
export function AIComposer() {
const [prompt, setPrompt] = useState('');
@@ -32,72 +31,13 @@ export function AIComposer() {
maxWidth: 'calc(100% - 48px)',
zIndex: 100,
}}>
- <div
- style={{
- borderRadius: 20,
- backgroundColor: 'var(--color-background-card)',
- border: '1px solid var(--color-divider)',
- boxShadow: 'var(--shadow-high)',
- overflow: 'hidden',
- padding: 8,
- display: 'flex',
- flexDirection: 'column' as const,
- gap: 8,
- }}>
- <div
- style={{
- display: 'flex',
- flexDirection: 'column' as const,
- alignItems: 'flex-end',
- }}>
- <div
- style={{
- display: 'flex',
- alignItems: 'center',
- width: '100%',
- padding: 8,
- }}>
- <input
- style={{
- flex: 1,
- border: 'none',
- outline: 'none',
- backgroundColor: 'transparent',
- fontFamily: 'inherit',
- fontSize: 14,
- }}
- placeholder="What should we build?"
- value={prompt}
- onChange={e => setPrompt(e.target.value)}
- />
- </div>
- <div
- style={{
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'space-between',
- width: '100%',
- paddingInlineStart: 4,
- paddingTop: 4,
- }}>
- <XDSButton
- label="Attach"
- variant="ghost"
- size="sm"
- isIconOnly
- icon={<PlusIcon />}
- />
- <XDSButton
- label="Send"
- variant="primary"
- size="sm"
- isIconOnly
- icon={<SendIcon />}
- style={{borderRadius: 9999}}
- />
- </div>
- </div>
- </div>
+ <XDSChatComposer
+ onSubmit={() => setPrompt('')}
+ value={prompt}
+ onChange={setPrompt}
+ placeholder="What should we build?"
+ input={<XDSChatComposerInput placeholder="What should we build?" />}
+ />
</div>
</>
);
diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/AppTopNav.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/AppTopNav.tsx
index dbf26ad7fa..7221a2c450 100644
--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/AppTopNav.tsx
+++ b/apps/sandbox/src/app/(fullscreen)/pages/docsite/AppTopNav.tsx
@@ -1,261 +1,116 @@
'use client';
import React, {useState, useEffect} from 'react';
+import {XDSTopNav, XDSTopNavHeading} from '@xds/core/TopNav';
import {XDSTabList, XDSTab} from '@xds/core/TabList';
-import {XDSText} from '@xds/core/Text';
import {XDSButton} from '@xds/core/Button';
+import {XDSStack} from '@xds/core/Layout';
import {XDSList, XDSListItem} from '@xds/core/List';
import {XDSCommandPalette} from '@xds/core/CommandPalette';
-import {SearchIcon, ProfileIcon, FilterIcon} from './docsite-icons';
+import {SearchIcon, ProfileIcon} from './docsite-icons';
import {SEARCH_COMMANDS} from './constants';
-import LogoNav from './LogoNav';
+
+const XDS_WORDMARK = (
+ <svg
+ width="46"
+ height="24"
+ viewBox="0 0 46 24"
+ fill="none"
+ xmlns="http://www.w3.org/2000/svg">
+ <path
+ d="M2.4239 15.8011C2.03945 16.3796 1.66972 16.9538 1.3147 17.524C0.707427 18.4992 1.42354 19.7348 2.57241 19.7348C3.13302 19.7348 3.64463 19.4209 3.91525 18.93C4.29391 18.243 4.71274 17.5352 5.17173 16.8066C5.38894 16.4618 5.60743 16.12 5.82721 15.7812C6.25251 15.1254 6.46516 14.7976 6.76252 14.68C6.99255 14.5891 7.27368 14.5899 7.50317 14.6822C7.79984 14.8014 8.00881 15.1278 8.42675 15.7804C8.64287 16.1179 8.85732 16.46 9.07008 16.8066C9.52175 17.534 9.93823 18.2339 10.3195 18.9063C10.6075 19.4141 11.1428 19.7348 11.7266 19.7348C12.9476 19.7348 13.7063 18.4203 13.0547 17.3877C12.7332 16.8781 12.3991 16.3639 12.0525 15.8453C11.3983 14.8527 10.7379 13.8906 10.0714 12.9592C9.81687 12.6036 9.68962 12.4258 9.64377 12.2384C9.60589 12.0836 9.60492 11.9307 9.64085 11.7754C9.68435 11.5874 9.80856 11.4091 10.057 11.0526C10.7093 10.1164 11.3596 9.15781 12.0078 8.1768C12.3869 7.60474 12.7521 7.03681 13.1035 6.47298C13.71 5.49987 12.9962 4.26519 11.8496 4.26519C11.2943 4.26519 10.7868 4.57405 10.5169 5.05923C10.1399 5.73688 9.72461 6.43721 9.27114 7.16022C9.06143 7.49458 8.8505 7.82569 8.63835 8.15358C8.21478 8.80819 8.003 9.1355 7.70554 9.25334C7.47561 9.34442 7.19397 9.34375 6.96448 9.25156C6.66759 9.13229 6.45853 8.80578 6.04043 8.15276C5.83116 7.82591 5.62351 7.49506 5.41747 7.16022C4.97918 6.44793 4.5738 5.76096 4.20132 5.0993C3.9136 4.58821 3.37617 4.26519 2.78967 4.26519C1.56624 4.26519 0.805692 5.58299 1.45419 6.62041C1.76588 7.11903 2.08912 7.6231 2.4239 8.1326C3.0752 9.10994 3.73263 10.059 4.3962 10.9796C4.65373 11.337 4.7825 11.5156 4.82882 11.7042C4.86709 11.86 4.86797 12.0139 4.83149 12.1702C4.78732 12.3593 4.66122 12.5385 4.40903 12.897C3.74526 13.8406 3.08355 14.8086 2.4239 15.8011Z"
+ fill="currentColor"
+ />
+ <path
+ fillRule="evenodd"
+ clipRule="evenodd"
+ d="M22.4734 4.26519C20.4471 4.26519 19.434 4.26519 18.6657 4.67201C18.0456 5.00031 17.5385 5.50739 17.2102 6.12744C16.8034 6.89579 16.8034 7.90892 16.8034 9.9352V14.0648C16.8034 16.0911 16.8034 17.1042 17.2102 17.8726C17.5385 18.4926 18.0456 18.9997 18.6657 19.328C19.434 19.7348 20.4471 19.7348 22.4734 19.7348H23.2039C24.8496 19.7348 26.2644 19.4033 27.4485 18.7403C28.6399 18.07 29.5559 17.1529 30.1963 15.989C30.8367 14.825 31.1569 13.4954 31.1569 12C31.1569 10.5046 30.8367 9.17495 30.1963 8.01105C29.5559 6.84714 28.6399 5.9337 27.4485 5.27072C26.2644 4.60037 24.8496 4.26519 23.2039 4.26519H22.4734ZM20.0092 8.74707C20.0092 8.16814 20.0092 7.87867 20.1255 7.65914C20.2193 7.48198 20.3641 7.33711 20.5413 7.24331C20.7608 7.12707 21.0503 7.12707 21.6292 7.12707H23.1927C24.6522 7.12707 25.7916 7.57274 26.6107 8.46409C27.4299 9.34807 27.8394 10.5267 27.8394 12C27.8394 13.4659 27.4299 14.6446 26.6107 15.5359C25.7916 16.4273 24.6522 16.8729 23.1927 16.8729H21.6292C21.0503 16.8729 20.7608 16.8729 20.5413 16.7567C20.3641 16.6629 20.2193 16.518 20.1255 16.3409C20.0092 16.1213 20.0092 15.8319 20.0092 15.2529V8.74707Z"
+ fill="currentColor"
+ />
+ <path
+ d="M35.4666 19.2376C36.6134 19.7459 37.9501 20 39.4767 20H39.8006C41.7144 20 43.2261 19.5801 44.3357 18.7403C45.4452 17.9006 46 16.7403 46 15.2597C46 14.3757 45.8213 13.6501 45.4638 13.0829C45.1064 12.5083 44.6559 12.0589 44.1123 11.7348C43.5761 11.4033 43.0325 11.1565 42.4814 10.9945C41.9304 10.8324 41.4575 10.7145 41.0628 10.6409L38.706 10.1878C38.0283 10.0552 37.4698 9.87477 37.0305 9.64641C36.5985 9.41068 36.3826 9.02762 36.3826 8.49724C36.3826 7.96685 36.6395 7.55064 37.1533 7.24862C37.6671 6.93923 38.3857 6.78453 39.3091 6.78453H39.6219C40.3964 6.78453 41.1224 6.93186 41.8001 7.22652C42.0982 7.35474 42.3899 7.5234 42.6754 7.73251C43.326 8.20923 44.2444 8.27802 44.8243 7.71734C45.34 7.21868 45.4053 6.39786 44.8761 5.91349C44.3498 5.43171 43.7638 5.03698 43.1181 4.72928C42.1054 4.24309 40.9511 4 39.6554 4H39.3315C38.0953 4 37.0156 4.19521 36.0922 4.58564C35.1762 4.97606 34.4613 5.52486 33.9475 6.23204C33.4411 6.93186 33.188 7.76059 33.188 8.71823C33.188 9.49171 33.3406 10.1436 33.6459 10.674C33.9587 11.2044 34.3571 11.6354 34.8411 11.9669C35.3326 12.2983 35.8539 12.5599 36.4049 12.7514C36.956 12.9355 37.4698 13.0718 37.9464 13.1602L40.3033 13.6243C40.6905 13.698 41.074 13.8011 41.4538 13.9337C41.841 14.0589 42.1612 14.2431 42.4144 14.4862C42.6676 14.7293 42.7942 15.0608 42.7942 15.4807C42.7942 16.6151 41.7814 17.1823 39.7559 17.1823H39.4432C38.49 17.1823 37.615 17.0055 36.8182 16.6519C36.4847 16.4994 36.1665 16.3134 35.8635 16.0938C35.17 15.5911 34.1857 15.5241 33.5784 16.1282C33.0651 16.6388 32.9912 17.4631 33.5198 17.9578C34.0797 18.4818 34.7287 18.9083 35.4666 19.2376Z"
+ fill="currentColor"
+ />
+ </svg>
+);
export function AppTopNav({
- activeView,
+ activeView: _activeView,
setActiveView,
- scrollContainerRef,
+ scrollContainerRef: _scrollContainerRef,
+ activeTab,
+ onActiveTabChange,
}: {
activeView: 'craft' | 'explore' | 'docs' | 'profile';
setActiveView: (view: 'craft' | 'explore' | 'docs' | 'profile') => void;
scrollContainerRef?: React.RefObject<HTMLDivElement | null>;
+ activeTab: string;
+ onActiveTabChange: (tab: string) => void;
}) {
const [isSearchOpen, setIsSearchOpen] = useState(false);
- const [activeTab, setActiveTab] = useState('all');
- const [isFilterOpen, setIsFilterOpen] = useState(false);
const [isScrolled, setIsScrolled] = useState(false);
useEffect(() => {
+ const el = document.getElementById('xds-app-shell-main');
+ if (!el) return;
const handleScroll = () => {
- const scrollTop = scrollContainerRef?.current
- ? scrollContainerRef.current.scrollTop
- : window.scrollY;
- setIsScrolled(scrollTop > 120);
+ setIsScrolled(el.scrollTop > 170);
};
- const target = scrollContainerRef?.current ?? window;
- target.addEventListener('scroll', handleScroll, {passive: true});
- return () => target.removeEventListener('scroll', handleScroll);
- }, [scrollContainerRef]);
+ el.addEventListener('scroll', handleScroll, {passive: true});
+ handleScroll();
+ return () => el.removeEventListener('scroll', handleScroll);
+ }, []);
+
+ const headingMenu = (
+ <XDSList density="spacious" style={{minWidth: 240}}>
+ <XDSListItem label="Craft" onClick={() => setActiveView('craft')} />
+ <XDSListItem label="Library" onClick={() => setActiveView('docs')} />
+ </XDSList>
+ );
return (
<>
- {/* Top nav bar — becomes combined bar when scrolled */}
- <nav
- style={{
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'space-between',
- height: 48,
- padding: '0 16px 0 24px',
- backgroundColor: 'var(--color-background-surface, white)',
- position: 'sticky',
- top: 0,
- zIndex: 11,
- transition:
- 'box-shadow 300ms var(--ease-standard, cubic-bezier(0.24, 1, 0.4, 1))',
- boxShadow:
- isScrolled && !isFilterOpen
- ? '0 1px 3px rgba(0,0,0,0.08)'
- : 'none',
- }}>
- {/* Left: logo nav */}
- <div style={{display: 'flex', alignItems: 'center', gap: 8, flex: 1}}>
- <LogoNav activeView={activeView} setActiveView={setActiveView} />
- </div>
-
- {/* Center: tabs (slide in when scrolled) */}
- <div
- style={{
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- opacity: isScrolled ? 1 : 0,
- transform: isScrolled ? 'translateY(0)' : 'translateY(-8px)',
- transition:
- 'opacity 300ms var(--ease-standard, cubic-bezier(0.24, 1, 0.4, 1)), transform 300ms var(--ease-standard, cubic-bezier(0.24, 1, 0.4, 1))',
- pointerEvents: isScrolled ? ('auto' as const) : ('none' as const),
- }}>
- <XDSTabList value={activeTab} onChange={setActiveTab} size="sm">
- <XDSTab value="all" label="All" />
- <XDSTab value="templates" label="Templates" />
- <XDSTab value="theme" label="Theme" />
- <XDSTab value="components" label="Components" />
- </XDSTabList>
- </div>
-
- {/* Right: search + profile */}
- <div
- style={{
- display: 'flex',
- alignItems: 'center',
- gap: 4,
- flex: 1,
- justifyContent: 'flex-end',
- }}>
- {isScrolled && (
+ <XDSTopNav
+ label="XDS navigation"
+ heading={
+ <XDSTopNavHeading
+ logo={XDS_WORDMARK}
+ headingHref="/pages/docsite/"
+ menu={headingMenu}
+ />
+ }
+ centerContent={
+ isScrolled ? (
+ <XDSTabList
+ value={activeTab}
+ onChange={onActiveTabChange}
+ size="sm">
+ <XDSTab value="all" label="All" />
+ <XDSTab value="templates" label="Templates" />
+ <XDSTab value="theme" label="Theme" />
+ <XDSTab value="components" label="Components" />
+ </XDSTabList>
+ ) : undefined
+ }
+ endContent={
+ <XDSStack direction="horizontal" gap={2}>
<XDSButton
- label="Filter"
+ label="Search"
variant="ghost"
- size="sm"
isIconOnly
- icon={<FilterIcon />}
- onClick={() => setIsFilterOpen(!isFilterOpen)}
+ icon={<SearchIcon />}
+ onClick={() => setIsSearchOpen(true)}
/>
- )}
- <XDSButton
- label="Search"
- variant="ghost"
- size="sm"
- isIconOnly
- icon={<SearchIcon />}
- onClick={() => setIsSearchOpen(true)}
- />
- <XDSButton
- label="Profile"
- variant="ghost"
- size="sm"
- isIconOnly
- icon={<ProfileIcon />}
- onClick={() => setActiveView('profile')}
- />
- </div>
- </nav>
-
- {/* Hero section — collapses when scrolled */}
- <div
- style={{
- display: 'flex',
- flexDirection: 'column',
- alignItems: 'center',
- padding: '16px 16px 48px',
- maxHeight: isScrolled ? 0 : 200,
- overflow: 'hidden',
- opacity: isScrolled ? 0 : 1,
- transition:
- 'max-height 300ms ease, opacity 200ms ease, padding 300ms ease',
- ...(isScrolled ? {padding: 0} : {}),
- }}>
- <div style={{textAlign: 'center'}}>
- <XDSText type="display-1">Craft what you imagine.</XDSText>
- </div>
- </div>
-
- {/* Tabs row — collapses when scrolled (tabs move to nav bar) */}
- <div
- style={{
- display: 'grid',
- gridTemplateColumns: '1fr auto 1fr',
- alignItems: 'center',
- padding: '0 16px 8px',
- position: 'sticky',
- top: 48,
- zIndex: 10,
- backgroundColor: 'var(--color-background-card, white)',
- maxHeight: isScrolled ? 0 : 60,
- overflow: 'hidden',
- opacity: isScrolled ? 0 : 1,
- transition:
- 'max-height 300ms ease, opacity 200ms ease, padding 300ms ease',
- ...(isScrolled ? {padding: 0} : {}),
- }}>
- <div />
- <XDSTabList value={activeTab} onChange={setActiveTab} size="sm">
- <XDSTab value="all" label="All" />
- <XDSTab value="templates" label="Templates" />
- <XDSTab value="theme" label="Theme" />
- <XDSTab value="components" label="Components" />
- </XDSTabList>
- <div style={{justifySelf: 'end'}}>
- <XDSButton
- label="Filter"
- variant="ghost"
- size="sm"
- isIconOnly
- icon={<FilterIcon />}
- onClick={() => setIsFilterOpen(!isFilterOpen)}
- />
- </div>
- </div>
-
- <div
- style={{
- display: 'grid',
- gridTemplateColumns: isFilterOpen
- ? '1fr 1fr 1fr 1fr'
- : '1fr 1fr 1fr 1fr',
- gap: isFilterOpen ? 24 : 0,
- boxShadow:
- isFilterOpen && isScrolled
- ? '0 1px 3px rgba(0,0,0,0.08)'
- : 'none',
- padding: isFilterOpen ? '24px 40px' : '0 40px',
- maxHeight: isFilterOpen ? 400 : 0,
- overflow: 'hidden',
- opacity: isFilterOpen ? 1 : 0,
- transition:
- 'max-height var(--duration-medium, 410ms) var(--ease-standard, cubic-bezier(0.24, 1, 0.4, 1)), opacity var(--duration-fast, 175ms) var(--ease-standard, cubic-bezier(0.24, 1, 0.4, 1)), padding var(--duration-medium, 410ms) var(--ease-standard, cubic-bezier(0.24, 1, 0.4, 1)), gap var(--duration-medium, 410ms) var(--ease-standard, cubic-bezier(0.24, 1, 0.4, 1))',
- }}>
- {[
- {
- heading: 'Categories',
- items: [
- 'AI',
- 'Health & Fitness',
- 'Productivity',
- 'Shopping',
- 'Education',
- ],
- },
- {
- heading: 'Screens',
- items: [
- 'My Account & Profile',
- 'Charts',
- 'Login',
- 'Filter & Sort',
- 'Signup',
- ],
- },
- {
- heading: 'UI Elements',
- items: [
- 'Dropdown Menu',
- 'Side Navigation',
- 'Stepper',
- 'Text Field',
- 'Navigation Menu',
- ],
- },
- {
- heading: 'Flows',
- items: [
- 'Reporting',
- 'Resetting Password',
- 'Onboarding',
- 'Setting Up',
- 'Filtering & Sorting',
- ],
- },
- ].map(col => (
- <div key={col.heading}>
- <XDSText
- type="supporting"
- color="secondary"
- style={{
- marginBottom: 12,
- display: 'block',
- }}>
- {col.heading}
- </XDSText>
- <div style={{marginLeft: -8, marginRight: -8}}>
- <XDSList density="compact">
- {col.items.map(item => (
- <XDSListItem key={item} label={item} onClick={() => {}} />
- ))}
- </XDSList>
- </div>
- </div>
- ))}
- </div>
+ <XDSButton
+ label="Profile"
+ variant="ghost"
+ isIconOnly
+ icon={<ProfileIcon />}
+ onClick={() => setActiveView('profile')}
+ />
+ </XDSStack>
+ }
+ />
<XDSCommandPalette
isOpen={isSearchOpen}
diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/BoidsCanvas.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/BoidsCanvas.tsx
deleted file mode 100644
index 5cacb95c3f..0000000000
--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/BoidsCanvas.tsx
+++ /dev/null
@@ -1,252 +0,0 @@
-'use client';
-
-import React, {useEffect, useRef} from 'react';
-import {CELL_W, CELL_H, DENSITY_LEVELS, SIM_COUNT} from './constants';
-
-// ---------------------------------------------------------------------------
-// Types
-// ---------------------------------------------------------------------------
-
-export interface BoidState {
- x: number;
- y: number;
- vx: number;
- vy: number;
-}
-
-export interface BoidsSimulation {
- boids: BoidState[];
- update: () => void;
-}
-
-// ---------------------------------------------------------------------------
-// Helpers
-// ---------------------------------------------------------------------------
-
-export function parseColor(color: string): [number, number, number] {
- const el = document.createElement('div');
- el.style.color = color;
- document.body.appendChild(el);
- const computed = getComputedStyle(el).color;
- document.body.removeChild(el);
- const m = computed.match(/(\d+)/g);
- return m ? [+m[0], +m[1], +m[2]] : [0, 0, 0];
-}
-
-export function createBoid(): BoidState {
- const a = Math.random() * Math.PI * 2;
- const s = 0.001 + Math.random() * 0.002;
- return {
- x: Math.random(),
- y: Math.random(),
- vx: Math.cos(a) * s,
- vy: Math.sin(a) * s,
- };
-}
-
-export function createSimulation(): BoidsSimulation {
- const boids: BoidState[] = [];
- for (let i = 0; i < SIM_COUNT; i++) boids.push(createBoid());
- let wax = 0.5,
- way = 0.5,
- wvx = 0.0005,
- wvy = 0.0003;
-
- function getNearestN(b: BoidState, n: number) {
- const d: {o: BoidState; d2: number}[] = [];
- for (const o of boids) {
- if (o === b) continue;
- const dx = o.x - b.x,
- dy = o.y - b.y;
- d.push({o, d2: dx * dx + dy * dy});
- }
- d.sort((a, c) => a.d2 - c.d2);
- return d.slice(0, n).map(x => x.o);
- }
-
- function update() {
- const maxSpd = 0.006;
- const cohW = 0.06;
- const swirlW = 0.03;
- const sepW = 0.4;
- const aliW = 0.08;
- const SEP_D = 0.025;
-
- wax += wvx;
- way += wvy;
- wvx += (Math.random() - 0.5) * 0.00015;
- wvy += (Math.random() - 0.5) * 0.00012;
- const ws = Math.sqrt(wvx * wvx + wvy * wvy);
- if (ws > 0.001) {
- wvx = (wvx / ws) * 0.001;
- wvy = (wvy / ws) * 0.001;
- }
- if (wax < 0.15 || wax > 0.85) wvx *= -1;
- if (way < 0.15 || way > 0.85) wvy *= -1;
-
- for (const b of boids) {
- const nb = getNearestN(b, 7);
- let cx = 0,
- cy = 0,
- ax = 0,
- ay = 0,
- sx = 0,
- sy = 0;
- for (const o of nb) {
- cx += o.x;
- cy += o.y;
- ax += o.vx;
- ay += o.vy;
- const dx = b.x - o.x,
- dy = b.y - o.y,
- dd = Math.sqrt(dx * dx + dy * dy) + 0.0001;
- if (dd < SEP_D) {
- sx += dx / dd;
- sy += dy / dd;
- }
- }
- const n = nb.length;
- if (n > 0) {
- cx /= n;
- cy /= n;
- const tx = cx - b.x,
- ty = cy - b.y;
- b.vx += tx * cohW;
- b.vy += ty * cohW;
- b.vx += -ty * swirlW;
- b.vy += tx * swirlW;
- ax /= n;
- ay /= n;
- b.vx += (ax - b.vx) * aliW;
- b.vy += (ay - b.vy) * aliW;
- }
- b.vx += sx * sepW;
- b.vy += sy * sepW;
-
- const wdx = wax - b.x,
- wdy = way - b.y,
- wd = Math.sqrt(wdx * wdx + wdy * wdy) + 0.001;
- b.vx += (wdx / wd) * 0.00002 * wd * 100;
- b.vy += (wdy / wd) * 0.00002 * wd * 100;
-
- const s = Math.sqrt(b.vx * b.vx + b.vy * b.vy);
- const mn = maxSpd * 0.3;
- if (s > maxSpd) {
- b.vx = (b.vx / s) * maxSpd;
- b.vy = (b.vy / s) * maxSpd;
- }
- if (s < mn && s > 0) {
- b.vx = (b.vx / s) * mn;
- b.vy = (b.vy / s) * mn;
- }
- b.x += b.vx;
- b.y += b.vy;
- if (b.x < 0) b.x += 1;
- if (b.x > 1) b.x -= 1;
- if (b.y < 0) b.y += 1;
- if (b.y > 1) b.y -= 1;
- }
- }
-
- return {boids, update};
-}
-
-export function getDensityLevel(density: number) {
- let lvl = DENSITY_LEVELS[0];
- for (const l of DENSITY_LEVELS) {
- if (density >= l.min) lvl = l;
- else break;
- }
- return lvl;
-}
-
-// ---------------------------------------------------------------------------
-// Component
-// ---------------------------------------------------------------------------
-
-export function BoidsCanvas({
- width,
- height,
- simulation,
-}: {
- width: number;
- height: number;
- simulation: BoidsSimulation;
-}) {
- const canvasRef = useRef(null as HTMLCanvasElement | null);
- const colorsRef = useRef(null as {
- secondary: [number, number, number];
- primary: [number, number, number];
- } | null);
-
- useEffect(() => {
- colorsRef.current = {
- secondary: parseColor('var(--color-icon-secondary, #666)'),
- primary: parseColor('var(--color-icon-primary, #111)'),
- };
- }, []);
-
- useEffect(() => {
- const canvas = canvasRef.current;
- if (!canvas || width === 0 || height === 0) return;
-
- const dpr = window.devicePixelRatio || 1;
- canvas.width = width * dpr;
- canvas.height = height * dpr;
- const ctx = canvas.getContext('2d');
- if (!ctx) return;
- ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
-
- const W = width;
- const H = height;
- const cols = Math.floor(W / CELL_W);
- const rows = Math.floor(H / CELL_H);
-
- let animId = 0;
- function render() {
- const colors = colorsRef.current;
- if (!colors) {
- animId = requestAnimationFrame(render);
- return;
- }
- ctx!.fillStyle = '#fff';
- ctx!.fillRect(0, 0, W, H);
-
- const densityGrid = new Float32Array(cols * rows);
- for (const b of simulation.boids) {
- const c = Math.floor(b.x * cols),
- r = Math.floor(b.y * rows);
- if (c >= 0 && c < cols && r >= 0 && r < rows)
- densityGrid[r * cols + c]++;
- }
-
- ctx!.textBaseline = 'top';
- for (const b of simulation.boids) {
- const col = Math.floor(b.x * cols),
- row = Math.floor(b.y * rows);
- if (col < 0 || col >= cols || row < 0 || row >= rows) continue;
- const density = densityGrid[row * cols + col];
- const lvl = getDensityLevel(density);
- const rgb = lvl.usePrimary ? colors.primary : colors.secondary;
- ctx!.font = lvl.font;
- ctx!.fillStyle = `rgba(${rgb[0]},${rgb[1]},${rgb[2]},${lvl.alpha})`;
- ctx!.fillText(lvl.chars[0], col * CELL_W, row * CELL_H);
- }
- animId = requestAnimationFrame(render);
- }
- animId = requestAnimationFrame(render);
-
- return () => cancelAnimationFrame(animId);
- }, [width, height, simulation]);
-
- return (
- <canvas
- ref={canvasRef}
- style={{
- display: 'block',
- width: '100%',
- aspectRatio: '1920 / 1200',
- }}
- />
- );
-}
diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/ChatPanel.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/ChatPanel.tsx
index 418df76d3b..a589ccdd41 100644
--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/ChatPanel.tsx
+++ b/apps/sandbox/src/app/(fullscreen)/pages/docsite/ChatPanel.tsx
@@ -1,13 +1,29 @@
'use client';
+import * as stylex from '@stylexjs/stylex';
import React, {useState} from 'react';
import {XDSButton} from '@xds/core/Button';
-import {XDSHeading, XDSText} from '@xds/core/Text';
-import {PlusIcon, SendIcon, SidebarIcon, ArrowLeftIcon, GridIcon, SparklesIcon, StopIcon, ChevronDownIcon} from './docsite-icons';
-import LogoNav from './LogoNav';
+import {
+ XDSChatComposer,
+ XDSChatComposerInput,
+ XDSChatMessage,
+ XDSChatMessageBubble,
+} from '@xds/core/Chat';
+import {XDSCodeBlock} from '@xds/core/CodeBlock';
+import {XDSDivider} from '@xds/core/Divider';
+import {XDSEmptyState} from '@xds/core/EmptyState';
+import {XDSMetadataList, XDSMetadataListItem} from '@xds/core/MetadataList';
+import {XDSText} from '@xds/core/Text';
+import {ArrowLeftIcon} from './docsite-icons';
import {ShimmerText} from './ShimmerText';
import {MOCK_CODE} from './constants';
+const composerStyles = stylex.create({
+ noShadow: {
+ boxShadow: 'none',
+ },
+});
+
export type PanelTab = 'configure' | 'properties' | 'code';
export type PointedElement = {
@@ -19,8 +35,8 @@ export type PointedElement = {
export function ChatPanel({
isGenerating,
onSend,
- activeView,
- setActiveView,
+ activeView: _activeView,
+ setActiveView: _setActiveView,
templateName,
onBack,
activeTab,
@@ -40,7 +56,6 @@ export function ChatPanel({
hideHeader?: boolean;
}) {
const [prompt, setPrompt] = useState('');
- const [codeContent, setCodeContent] = useState(MOCK_CODE);
const tab = activeTab ?? 'configure';
return (
@@ -51,26 +66,6 @@ export function ChatPanel({
height: '100%',
width: '100%',
}}>
- {/* Header: logo or back+title */}
- {!hideHeader && !templateName && (
- <div
- style={{
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'space-between',
- padding: '12px 16px',
- flexShrink: 0,
- }}>
- <LogoNav activeView={activeView} setActiveView={setActiveView} />
- <XDSButton
- label="Toggle sidebar"
- variant="ghost"
- size="sm"
- isIconOnly
- icon={<SidebarIcon />}
- />
- </div>
- )}
{/* Tab bar (editor mode only) */}
{!hideHeader && templateName && onTabChange && (
<div
@@ -110,9 +105,7 @@ export function ChatPanel({
textAlign: 'center' as const,
transition: 'border-color 150ms ease',
}}>
- <XDSText
- type="body"
- color={tab === t ? 'primary' : 'secondary'}>
+ <XDSText type="body" color={tab === t ? 'primary' : 'secondary'}>
{t === 'configure'
? 'Craft'
: t === 'properties'
@@ -128,17 +121,13 @@ export function ChatPanel({
{(!templateName || !onTabChange || tab === 'configure') && (
<>
<div style={{flex: 1, padding: 16, overflow: 'auto'}}>
- <div
- style={{
- backgroundColor: 'var(--color-background-body, #f1f4f7)',
- borderRadius: 12,
- padding: 12,
- marginBottom: 16,
- }}>
- <XDSText type="body">
- Can you customize this template by adding a divider line under
- the header and use a card for the lists
- </XDSText>
+ <div style={{marginBottom: 16}}>
+ <XDSChatMessage sender="user">
+ <XDSChatMessageBubble>
+ Can you customize this template by adding a divider line under
+ the header and use a card for the lists
+ </XDSChatMessageBubble>
+ </XDSChatMessage>
</div>
<div style={{padding: '0 4px'}}>
<ShimmerText isActive={isGenerating} />
@@ -149,59 +138,17 @@ export function ChatPanel({
style={{
padding: templateName ? 12 : 12,
}}>
- <div
- style={{
- borderRadius: 16,
- backgroundColor: 'var(--color-background-card, white)',
- border: '1px solid var(--color-divider, #e0e0e0)',
- padding: 8,
- display: 'flex',
- flexDirection: 'column' as const,
- gap: 8,
- }}>
- <div
- style={{display: 'flex', alignItems: 'center', padding: 8}}>
- <input
- style={{
- flex: 1,
- border: 'none',
- outline: 'none',
- backgroundColor: 'transparent',
- fontFamily: 'inherit',
- fontSize: 14,
- }}
- placeholder="Ask for changes"
- value={prompt}
- onChange={e => setPrompt(e.target.value)}
- />
- </div>
- <div
- style={{
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'space-between',
- width: '100%',
- paddingInlineStart: 4,
- paddingTop: 4,
- }}>
- <XDSButton
- label="Attach"
- variant="ghost"
- size="sm"
- isIconOnly
- icon={<PlusIcon />}
- />
- <XDSButton
- label="Send"
- variant="primary"
- size="sm"
- isIconOnly
- icon={<SendIcon />}
- style={{borderRadius: 9999}}
- onClick={onSend}
- />
- </div>
- </div>
+ <XDSChatComposer
+ onSubmit={() => {
+ onSend?.();
+ setPrompt('');
+ }}
+ value={prompt}
+ onChange={setPrompt}
+ placeholder="Ask for changes"
+ xstyle={composerStyles.noShadow}
+ input={<XDSChatComposerInput placeholder="Ask for changes" />}
+ />
</div>
</>
)}
@@ -210,154 +157,79 @@ export function ChatPanel({
{templateName && onTabChange && tab === 'properties' && (
<div style={{flex: 1, padding: 16, overflow: 'auto'}}>
{pointedElement ? (
- <div style={{display: 'flex', flexDirection: 'column' as const, gap: 16}}>
+ <div
+ style={{
+ display: 'flex',
+ flexDirection: 'column' as const,
+ gap: 16,
+ }}>
<div>
<XDSText type="supporting" color="secondary">
Element
</XDSText>
<XDSText type="body" style={{fontWeight: 600, marginTop: 4}}>
- {'<'}{pointedElement.tagName.toLowerCase()}{'>'}
+ {'<'}
+ {pointedElement.tagName.toLowerCase()}
+ {'>'}
{pointedElement.componentName && (
- <span style={{
- marginLeft: 8,
- fontSize: 12,
- color: 'var(--color-text-secondary, #65676B)',
- fontWeight: 400,
- }}>
+ <span
+ style={{
+ marginLeft: 8,
+ fontSize: 12,
+ color: 'var(--color-text-secondary, #65676B)',
+ fontWeight: 400,
+ }}>
{pointedElement.componentName}
</span>
)}
</XDSText>
</div>
- <div style={{height: 1, backgroundColor: 'var(--color-divider, #e0e0e0)'}} />
- <div>
- <XDSText type="supporting" color="secondary" style={{marginBottom: 8}}>
- Layout
- </XDSText>
- {[
- {label: 'Width', value: pointedElement.rect ? `${Math.round(pointedElement.rect.width)}px` : '—'},
- {label: 'Height', value: pointedElement.rect ? `${Math.round(pointedElement.rect.height)}px` : '—'},
- ].map(row => (
- <div
- key={row.label}
- style={{
- display: 'flex',
- justifyContent: 'space-between',
- padding: '6px 0',
- }}>
- <XDSText type="body" color="secondary">{row.label}</XDSText>
- <XDSText type="body" style={{fontFamily: '"Roboto Mono", monospace', fontSize: 13}}>{row.value}</XDSText>
- </div>
- ))}
- </div>
- <div style={{height: 1, backgroundColor: 'var(--color-divider, #e0e0e0)'}} />
- <div>
- <XDSText type="supporting" color="secondary" style={{marginBottom: 8}}>
- Styles
- </XDSText>
- {[
- {label: 'Background', value: '#ffffff'},
- {label: 'Border radius', value: '12px'},
- {label: 'Padding', value: '16px'},
- {label: 'Font size', value: '14px'},
- ].map(row => (
- <div
- key={row.label}
- style={{
- display: 'flex',
- justifyContent: 'space-between',
- padding: '6px 0',
- }}>
- <XDSText type="body" color="secondary">{row.label}</XDSText>
- <XDSText type="body" style={{fontFamily: '"Roboto Mono", monospace', fontSize: 13}}>{row.value}</XDSText>
- </div>
- ))}
- </div>
+ <XDSDivider />
+ <XDSMetadataList title="Layout">
+ <XDSMetadataListItem label="Width">
+ {pointedElement.rect
+ ? `${Math.round(pointedElement.rect.width)}px`
+ : '—'}
+ </XDSMetadataListItem>
+ <XDSMetadataListItem label="Height">
+ {pointedElement.rect
+ ? `${Math.round(pointedElement.rect.height)}px`
+ : '—'}
+ </XDSMetadataListItem>
+ </XDSMetadataList>
+ <XDSDivider />
+ <XDSMetadataList title="Styles">
+ <XDSMetadataListItem label="Background">
+ #ffffff
+ </XDSMetadataListItem>
+ <XDSMetadataListItem label="Border radius">
+ 12px
+ </XDSMetadataListItem>
+ <XDSMetadataListItem label="Padding">16px</XDSMetadataListItem>
+ <XDSMetadataListItem label="Font size">
+ 14px
+ </XDSMetadataListItem>
+ </XDSMetadataList>
</div>
) : (
- <div
- style={{
- display: 'flex',
- flexDirection: 'column' as const,
- alignItems: 'center',
- justifyContent: 'center',
- height: '100%',
- gap: 8,
- opacity: 0.5,
- }}>
- <svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
- <path d="M3 3l7.07 16.97 2.51-7.39 7.39-2.51L3 3z" />
- <path d="M13 13l6 6" />
- </svg>
- <XDSText type="body" color="secondary" style={{textAlign: 'center' as const}}>
- Click the Point tool in the toolbar, then click an element in the preview
- </XDSText>
- </div>
+ <XDSEmptyState
+ title="No element selected"
+ description="Click the Point tool in the toolbar, then click an element in the preview"
+ isCompact
+ />
)}
</div>
)}
{/* Code tab */}
{templateName && onTabChange && tab === 'code' && (
- <div style={{flex: 1, display: 'flex', flexDirection: 'column' as const, minHeight: 0}}>
- <div
- style={{
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'space-between',
- padding: '8px 12px 8px 16px',
- flexShrink: 0,
- }}>
- <span
- style={{
- fontFamily: '"Roboto Mono", monospace',
- fontSize: 12,
- fontWeight: 500,
- color: 'var(--color-text-secondary, #4e606f)',
- }}>
- typescript — useUser.ts
- </span>
- </div>
- <div style={{display: 'flex', flex: 1, minHeight: 0}}>
- <div
- style={{
- padding: '12px 12px 12px 16px',
- borderRight:
- '1px solid var(--color-divider, rgba(0,0,0,0.1))',
- fontFamily: '"Roboto Mono", monospace',
- fontSize: 13,
- lineHeight: '20px',
- color: 'var(--color-text-disabled, #a4b0bc)',
- textAlign: 'right' as const,
- userSelect: 'none' as const,
- minWidth: 36,
- }}>
- {codeContent.split('\n').map((_, i) => (
- <div key={i}>{i + 1}</div>
- ))}
- </div>
- <textarea
- value={codeContent}
- onChange={e => setCodeContent(e.target.value)}
- spellCheck={false}
- style={{
- flex: 1,
- padding: '12px 16px',
- fontFamily: '"Roboto Mono", monospace',
- fontSize: 13,
- lineHeight: '20px',
- margin: 0,
- overflow: 'auto',
- color: 'var(--color-text-primary, #0a1317)',
- backgroundColor: 'transparent',
- border: 'none',
- outline: 'none',
- resize: 'none',
- whiteSpace: 'pre',
- tabSize: 2,
- }}
- />
- </div>
+ <div style={{flex: 1, minHeight: 0, overflow: 'auto'}}>
+ <XDSCodeBlock
+ code={MOCK_CODE}
+ language="typescript"
+ title="useUser.ts"
+ hasLineNumbers
+ />
</div>
)}
</div>
diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/CraftingCat.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/CraftingCat.tsx
new file mode 100644
index 0000000000..81f3208188
--- /dev/null
+++ b/apps/sandbox/src/app/(fullscreen)/pages/docsite/CraftingCat.tsx
@@ -0,0 +1,71 @@
+'use client';
+
+import React, {useState, useEffect} from 'react';
+
+const FRAMES = [
+ ' /\\_/\\\n ( o.o )\n \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 \u258b \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n /| \u2550\u2550\u2550\u2550\u2550\u2550\u2550 |\\',
+ ' /\\_/\\\n ( o.o )\n \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 _\u258b \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n \\| \u2550\u2550\u2550\u2550\u2550\u2550\u2550 |/',
+ ' /\\_/\\\n ( -.- )\n \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 __\u258b \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n /| \u2550\u2550\u2550\u2550\u2550\u2550\u2550 |\\',
+ ' /\\_/\\\n ( o.o )\n \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 ___\u258b \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n \\| \u2550\u2550\u2550\u2550\u2550\u2550\u2550 |/',
+ ' /\\_/\\\n ( o.o )\n \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 ____\u258b \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n /| \u2550\u2550\u2550\u2550\u2550\u2550\u2550 |\\',
+ ' /\\_/\\\n ( ^.^ )\n \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 \u258b \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n \\| \u2550\u2550\u2550\u2550\u2550\u2550\u2550 |/',
+];
+
+export function CraftingCat() {
+ const [frame, setFrame] = useState(0);
+
+ useEffect(() => {
+ const id = setInterval(() => {
+ setFrame(prev => (prev + 1) % FRAMES.length);
+ }, 350);
+ return () => clearInterval(id);
+ }, []);
+
+ return (
+ <>
+ <style>{`
+ @keyframes craftingShimmer {
+ 0% { background-position: -200% center; }
+ 100% { background-position: 200% center; }
+ }
+ `}</style>
+ <div
+ style={{
+ width: '100%',
+ height: '100%',
+ display: 'flex',
+ flexDirection: 'column',
+ alignItems: 'center',
+ justifyContent: 'center',
+ gap: 16,
+ backgroundColor: 'var(--color-background-surface, #fff)',
+ }}>
+ <pre
+ style={{
+ fontFamily:
+ '"JetBrains Mono", "Fira Code", "SF Mono", "Cascadia Code", monospace',
+ fontSize: 18,
+ lineHeight: 1.35,
+ color: 'var(--color-text-secondary, #65676B)',
+ margin: 0,
+ }}>
+ {FRAMES[frame]}
+ </pre>
+ <span
+ style={{
+ fontSize: 13,
+ fontWeight: 500,
+ letterSpacing: 0.5,
+ background:
+ 'linear-gradient(90deg, var(--color-text-secondary, #65676B) 40%, var(--color-text-primary, #111) 50%, var(--color-text-secondary, #65676B) 60%)',
+ backgroundSize: '200% auto',
+ WebkitBackgroundClip: 'text',
+ WebkitTextFillColor: 'transparent',
+ animation: 'craftingShimmer 2s linear infinite',
+ }}>
+ Crafting your UI...
+ </span>
+ </div>
+ </>
+ );
+}
diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/DocsView.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/DocsView.tsx
index 485884d487..26770e8c35 100644
--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/DocsView.tsx
+++ b/apps/sandbox/src/app/(fullscreen)/pages/docsite/DocsView.tsx
@@ -1,25 +1,58 @@
'use client';
import React, {useState} from 'react';
+import {XDSAppShell} from '@xds/core/AppShell';
+import {XDSTopNav, XDSTopNavHeading} from '@xds/core/TopNav';
+import {XDSSideNav, XDSSideNavItem, XDSSideNavSection} from '@xds/core/SideNav';
import {XDSHeading, XDSText} from '@xds/core/Text';
import {XDSButton} from '@xds/core/Button';
+import {XDSStack} from '@xds/core/Layout';
import {XDSCard} from '@xds/core/Card';
import {XDSDropdownMenu} from '@xds/core/DropdownMenu';
import {XDSList, XDSListItem} from '@xds/core/List';
import {XDSTable} from '@xds/core/Table';
-import {XDSTooltip} from '@xds/core/Tooltip';
-import {ExternalLinkIcon, ContrastIcon, FullscreenIcon} from './docsite-icons';
-import LogoNav, {XDS_LOGO_PLAIN} from './LogoNav';
-import {SectionLabel} from './ProfileView';
+import {XDSCommandPalette} from '@xds/core/CommandPalette';
+import {
+ ExternalLinkIcon,
+ ContrastIcon,
+ FullscreenIcon,
+ SearchIcon,
+ ProfileIcon,
+} from './docsite-icons';
import {COMPONENT_PREVIEWS} from './ComponentPreviews';
+import {SEARCH_COMMANDS} from './constants';
import {
COMPONENT_CATEGORIES,
getComponentName,
getComponentDocs,
} from './docsview-data';
+const XDS_WORDMARK = (
+ <svg
+ width="46"
+ height="24"
+ viewBox="0 0 46 24"
+ fill="none"
+ xmlns="http://www.w3.org/2000/svg">
+ <path
+ d="M2.4239 15.8011C2.03945 16.3796 1.66972 16.9538 1.3147 17.524C0.707427 18.4992 1.42354 19.7348 2.57241 19.7348C3.13302 19.7348 3.64463 19.4209 3.91525 18.93C4.29391 18.243 4.71274 17.5352 5.17173 16.8066C5.38894 16.4618 5.60743 16.12 5.82721 15.7812C6.25251 15.1254 6.46516 14.7976 6.76252 14.68C6.99255 14.5891 7.27368 14.5899 7.50317 14.6822C7.79984 14.8014 8.00881 15.1278 8.42675 15.7804C8.64287 16.1179 8.85732 16.46 9.07008 16.8066C9.52175 17.534 9.93823 18.2339 10.3195 18.9063C10.6075 19.4141 11.1428 19.7348 11.7266 19.7348C12.9476 19.7348 13.7063 18.4203 13.0547 17.3877C12.7332 16.8781 12.3991 16.3639 12.0525 15.8453C11.3983 14.8527 10.7379 13.8906 10.0714 12.9592C9.81687 12.6036 9.68962 12.4258 9.64377 12.2384C9.60589 12.0836 9.60492 11.9307 9.64085 11.7754C9.68435 11.5874 9.80856 11.4091 10.057 11.0526C10.7093 10.1164 11.3596 9.15781 12.0078 8.1768C12.3869 7.60474 12.7521 7.03681 13.1035 6.47298C13.71 5.49987 12.9962 4.26519 11.8496 4.26519C11.2943 4.26519 10.7868 4.57405 10.5169 5.05923C10.1399 5.73688 9.72461 6.43721 9.27114 7.16022C9.06143 7.49458 8.8505 7.82569 8.63835 8.15358C8.21478 8.80819 8.003 9.1355 7.70554 9.25334C7.47561 9.34442 7.19397 9.34375 6.96448 9.25156C6.66759 9.13229 6.45853 8.80578 6.04043 8.15276C5.83116 7.82591 5.62351 7.49506 5.41747 7.16022C4.97918 6.44793 4.5738 5.76096 4.20132 5.0993C3.9136 4.58821 3.37617 4.26519 2.78967 4.26519C1.56624 4.26519 0.805692 5.58299 1.45419 6.62041C1.76588 7.11903 2.08912 7.6231 2.4239 8.1326C3.0752 9.10994 3.73263 10.059 4.3962 10.9796C4.65373 11.337 4.7825 11.5156 4.82882 11.7042C4.86709 11.86 4.86797 12.0139 4.83149 12.1702C4.78732 12.3593 4.66122 12.5385 4.40903 12.897C3.74526 13.8406 3.08355 14.8086 2.4239 15.8011Z"
+ fill="currentColor"
+ />
+ <path
+ fillRule="evenodd"
+ clipRule="evenodd"
+ d="M22.4734 4.26519C20.4471 4.26519 19.434 4.26519 18.6657 4.67201C18.0456 5.00031 17.5385 5.50739 17.2102 6.12744C16.8034 6.89579 16.8034 7.90892 16.8034 9.9352V14.0648C16.8034 16.0911 16.8034 17.1042 17.2102 17.8726C17.5385 18.4926 18.0456 18.9997 18.6657 19.328C19.434 19.7348 20.4471 19.7348 22.4734 19.7348H23.2039C24.8496 19.7348 26.2644 19.4033 27.4485 18.7403C28.6399 18.07 29.5559 17.1529 30.1963 15.989C30.8367 14.825 31.1569 13.4954 31.1569 12C31.1569 10.5046 30.8367 9.17495 30.1963 8.01105C29.5559 6.84714 28.6399 5.9337 27.4485 5.27072C26.2644 4.60037 24.8496 4.26519 23.2039 4.26519H22.4734ZM20.0092 8.74707C20.0092 8.16814 20.0092 7.87867 20.1255 7.65914C20.2193 7.48198 20.3641 7.33711 20.5413 7.24331C20.7608 7.12707 21.0503 7.12707 21.6292 7.12707H23.1927C24.6522 7.12707 25.7916 7.57274 26.6107 8.46409C27.4299 9.34807 27.8394 10.5267 27.8394 12C27.8394 13.4659 27.4299 14.6446 26.6107 15.5359C25.7916 16.4273 24.6522 16.8729 23.1927 16.8729H21.6292C21.0503 16.8729 20.7608 16.8729 20.5413 16.7567C20.3641 16.6629 20.2193 16.518 20.1255 16.3409C20.0092 16.1213 20.0092 15.8319 20.0092 15.2529V8.74707Z"
+ fill="currentColor"
+ />
+ <path
+ d="M35.4666 19.2376C36.6134 19.7459 37.9501 20 39.4767 20H39.8006C41.7144 20 43.2261 19.5801 44.3357 18.7403C45.4452 17.9006 46 16.7403 46 15.2597C46 14.3757 45.8213 13.6501 45.4638 13.0829C45.1064 12.5083 44.6559 12.0589 44.1123 11.7348C43.5761 11.4033 43.0325 11.1565 42.4814 10.9945C41.9304 10.8324 41.4575 10.7145 41.0628 10.6409L38.706 10.1878C38.0283 10.0552 37.4698 9.87477 37.0305 9.64641C36.5985 9.41068 36.3826 9.02762 36.3826 8.49724C36.3826 7.96685 36.6395 7.55064 37.1533 7.24862C37.6671 6.93923 38.3857 6.78453 39.3091 6.78453H39.6219C40.3964 6.78453 41.1224 6.93186 41.8001 7.22652C42.0982 7.35474 42.3899 7.5234 42.6754 7.73251C43.326 8.20923 44.2444 8.27802 44.8243 7.71734C45.34 7.21868 45.4053 6.39786 44.8761 5.91349C44.3498 5.43171 43.7638 5.03698 43.1181 4.72928C42.1054 4.24309 40.9511 4 39.6554 4H39.3315C38.0953 4 37.0156 4.19521 36.0922 4.58564C35.1762 4.97606 34.4613 5.52486 33.9475 6.23204C33.4411 6.93186 33.188 7.76059 33.188 8.71823C33.188 9.49171 33.3406 10.1436 33.6459 10.674C33.9587 11.2044 34.3571 11.6354 34.8411 11.9669C35.3326 12.2983 35.8539 12.5599 36.4049 12.7514C36.956 12.9355 37.4698 13.0718 37.9464 13.1602L40.3033 13.6243C40.6905 13.698 41.074 13.8011 41.4538 13.9337C41.841 14.0589 42.1612 14.2431 42.4144 14.4862C42.6676 14.7293 42.7942 15.0608 42.7942 15.4807C42.7942 16.6151 41.7814 17.1823 39.7559 17.1823H39.4432C38.49 17.1823 37.615 17.0055 36.8182 16.6519C36.4847 16.4994 36.1665 16.3134 35.8635 16.0938C35.17 15.5911 34.1857 15.5241 33.5784 16.1282C33.0651 16.6388 32.9912 17.4631 33.5198 17.9578C34.0797 18.4818 34.7287 18.9083 35.4666 19.2376Z"
+ fill="currentColor"
+ />
+ </svg>
+);
+
export function DocsView({
- activeView,
+ activeView: _activeView,
setActiveView,
}: {
activeView: 'craft' | 'explore' | 'docs' | 'profile';
@@ -31,74 +64,74 @@ export function DocsView({
const [selectedComponent, setSelectedComponent] = useState(
null as string | null,
);
+ const [isSearchOpen, setIsSearchOpen] = useState(false);
+
+ const headingMenu = (
+ <XDSList density="spacious" style={{minWidth: 240}}>
+ <XDSListItem label="Craft" onClick={() => setActiveView('craft')} />
+ <XDSListItem label="Library" onClick={() => setActiveView('docs')} />
+ </XDSList>
+ );
return (
- <div
- style={{
- display: 'flex',
- height: '100vh',
- backgroundColor: 'var(--color-background-surface, #ffffff)',
- fontFamily: 'system-ui, -apple-system, sans-serif',
- }}>
- {/* LEFT SIDEBAR */}
- <aside
- style={{
- width: 240,
- minWidth: 240,
- height: '100vh',
- display: 'flex',
- flexDirection: 'column' as const,
- backgroundColor: 'var(--color-background-surface, #ffffff)',
- overflow: 'hidden',
- }}>
- {/* Header */}
- <div
- style={{
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'space-between',
- padding: '12px 8px 12px 8px',
- flexShrink: 0,
- }}>
- <div style={{display: 'flex', alignItems: 'center', gap: 6}}>
- <div style={{paddingLeft: 16}}>
- <LogoNav
- activeView={activeView}
- setActiveView={setActiveView}
- logo={XDS_LOGO_PLAIN}
+ <>
+ <XDSAppShell
+ variant="surface"
+ height="fill"
+ topNav={
+ <XDSTopNav
+ label="XDS navigation"
+ heading={
+ <XDSTopNavHeading
+ logo={XDS_WORDMARK}
+ headingHref="/pages/docsite/"
+ menu={headingMenu}
/>
- </div>
- </div>
- </div>
-
- {/* Nav */}
- <nav
- style={{
- flex: 1,
- overflowY: 'auto' as const,
- padding: '0 16px 16px 16px',
- }}>
- <XDSList density="balanced">
- <XDSListItem
- label="Overview"
- isSelected={selectedComponent === null}
- onClick={() => setSelectedComponent(null)}
- />
- <XDSListItem
- label="Getting started"
- isSelected={
- selectedComponent !== null && activeNav === 'getting-started'
- }
- onClick={() => setActiveNav('getting-started')}
- />
- </XDSList>
+ }
+ endContent={
+ <XDSStack direction="horizontal" gap={2}>
+ <XDSButton
+ label="Search"
+ variant="ghost"
+ isIconOnly
+ icon={<SearchIcon />}
+ onClick={() => setIsSearchOpen(true)}
+ />
+ <XDSButton
+ label="Profile"
+ variant="ghost"
+ isIconOnly
+ icon={<ProfileIcon />}
+ onClick={() => setActiveView('profile')}
+ />
+ </XDSStack>
+ }
+ />
+ }
+ sideNav={
+ <XDSSideNav>
+ <XDSSideNavSection title="Navigation" isHeaderHidden>
+ <XDSSideNavItem
+ label="Overview"
+ isSelected={selectedComponent === null}
+ onClick={() => setSelectedComponent(null)}
+ />
+ <XDSSideNavItem
+ label="Getting started"
+ isSelected={
+ selectedComponent !== null && activeNav === 'getting-started'
+ }
+ onClick={() => {
+ setSelectedComponent('getting-started');
+ setActiveNav('getting-started');
+ }}
+ />
+ </XDSSideNavSection>
- {COMPONENT_CATEGORIES.map(category => (
- <div key={category.label}>
- <SectionLabel label={category.label.toUpperCase()} />
- <XDSList density="balanced">
+ {COMPONENT_CATEGORIES.map(category => (
+ <XDSSideNavSection key={category.label} title={category.label}>
{category.items.map(item => (
- <XDSListItem
+ <XDSSideNavItem
key={item.key}
label={item.name}
isSelected={
@@ -110,21 +143,13 @@ export function DocsView({
}}
/>
))}
- </XDSList>
- </div>
- ))}
- </nav>
- </aside>
-
- {/* MAIN CONTENT */}
- <main
- style={{
- flex: 1,
- overflowY: 'auto' as const,
- padding: '32px 40px',
- }}>
+ </XDSSideNavSection>
+ ))}
+ </XDSSideNav>
+ }>
+ {/* MAIN CONTENT */}
{selectedComponent === null ? (
- <div style={{maxWidth: 1200, margin: '0 auto'}}>
+ <div style={{maxWidth: 1200, margin: '0 auto', padding: '32px 40px'}}>
{/* Page header — hero banner */}
<div
style={{
@@ -222,7 +247,7 @@ export function DocsView({
))}
</div>
) : (
- <div style={{maxWidth: 840, margin: '0 auto'}}>
+ <div style={{maxWidth: 840, margin: '0 auto', padding: '32px 40px'}}>
{/* Header */}
<div style={{marginBottom: 8}}>
<XDSText type="display-1">{getComponentName(activeNav)}</XDSText>
@@ -370,9 +395,7 @@ export function DocsView({
</div>
<div style={{marginTop: 16}}>
<XDSTable
- data={
- docs.anatomy as {[key: string]: unknown}[]
- }
+ data={docs.anatomy as {[key: string]: unknown}[]}
columns={[
{key: 'element', header: 'Element'},
{key: 'required', header: 'Required'},
@@ -385,7 +408,14 @@ export function DocsView({
})()}
</div>
)}
- </main>
- </div>
+ </XDSAppShell>
+
+ <XDSCommandPalette
+ isOpen={isSearchOpen}
+ onOpenChange={setIsSearchOpen}
+ searchSource={SEARCH_COMMANDS}
+ label="Search templates and components"
+ />
+ </>
);
}
diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/InlinePublishPanel.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/InlinePublishPanel.tsx
index 73d3af8519..33a9b99aca 100644
--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/InlinePublishPanel.tsx
+++ b/apps/sandbox/src/app/(fullscreen)/pages/docsite/InlinePublishPanel.tsx
@@ -2,6 +2,7 @@
import React, {useState} from 'react';
import {XDSButton} from '@xds/core/Button';
+import {XDSLink} from '@xds/core/Link';
import {XDSHeading, XDSText} from '@xds/core/Text';
import {XDSTextInput} from '@xds/core/TextInput';
import {XDSTextArea} from '@xds/core/TextArea';
@@ -9,7 +10,6 @@ import {XDSTokenizer} from '@xds/core/Tokenizer';
import {createStaticSource} from '@xds/core/Typeahead';
import {PUBLISH_TAGS} from './constants';
-
// ---------------------------------------------------------------------------
// InlinePublishPanel — publish flow rendered inline in the left panel
// ---------------------------------------------------------------------------
@@ -34,78 +34,97 @@ export function InlinePublishPanel({
return (
<>
- <style>
- {'@keyframes publishFadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }'}
- </style>
- <div
- style={{
- display: 'flex',
- flexDirection: 'column' as const,
- gap: 20,
- overflowY: 'auto' as const,
- flex: 1,
- margin: 16,
- animation: 'publishFadeIn 400ms cubic-bezier(0.16, 1, 0.3, 1)',
- }}>
- {/* Header */}
- <div style={{display: 'flex', flexDirection: 'column' as const, gap: 8}}>
- <XDSHeading level={2}>Publish to community</XDSHeading>
- <XDSText type="body" color="secondary">
- Share your work so others on the team can use it as a starting point.
- </XDSText>
- </div>
-
- {/* Template name input */}
- <XDSTextInput
- label="Template name"
- value={name}
- onChange={v => setName(v)}
- size="lg"
- />
-
- {/* Description textarea */}
- <XDSTextArea
- label="Description"
- placeholder="Describe what makes this template unique..."
- value={description}
- onChange={v => setDescription(v)}
- rows={3}
- />
-
- {/* Tags */}
- <XDSTokenizer
- label="Tags"
- searchSource={tagSource}
- value={tags}
- onChange={items => setTags(items)}
- placeholder="Add tags..."
- hasEntriesOnFocus
- hasCreate
- size="md"
- />
+ <style>
+ {
+ '@keyframes publishFadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }'
+ }
+ </style>
+ <div
+ style={{
+ display: 'flex',
+ flexDirection: 'column' as const,
+ gap: 20,
+ overflowY: 'auto' as const,
+ flex: 1,
+ margin: 16,
+ animation: 'publishFadeIn 400ms cubic-bezier(0.16, 1, 0.3, 1)',
+ }}>
+ {/* Header */}
+ <div
+ style={{display: 'flex', flexDirection: 'column' as const, gap: 8}}>
+ <XDSHeading level={2}>Publish to community</XDSHeading>
+ <XDSText type="body" color="secondary">
+ Share your work so others on the team can use it as a starting
+ point.
+ </XDSText>
+ </div>
- {/* Publish / Cancel buttons */}
- <div style={{display: 'flex', flexDirection: 'column' as const, gap: 8, marginTop: 'auto'}}>
- <XDSText type="supporting" color="secondary" style={{textAlign: 'center' as const}}>
- Your template will go through a review process before appearing in the community grid.{' '}
- <a href="#" onClick={e => e.preventDefault()} style={{color: 'var(--color-accent, #0066FF)', textDecoration: 'none'}}>Learn more</a>
- </XDSText>
- <XDSButton
- variant="primary"
- label="Submit template"
+ {/* Template name input */}
+ <XDSTextInput
+ label="Template name"
+ value={name}
+ onChange={v => setName(v)}
size="lg"
- onClick={onPublish}
- style={{width: '100%'}}
/>
- <XDSButton
- variant="secondary"
- label="Go back to editing"
- size="lg"
- onClick={onBack}
- style={{width: '100%'}}
+
+ {/* Description textarea */}
+ <XDSTextArea
+ label="Description"
+ placeholder="Describe what makes this template unique..."
+ value={description}
+ onChange={v => setDescription(v)}
+ rows={3}
/>
+
+ {/* Tags */}
+ <XDSTokenizer
+ label="Tags"
+ searchSource={tagSource}
+ value={tags}
+ onChange={items => setTags(items)}
+ placeholder="Add tags..."
+ hasEntriesOnFocus
+ hasCreate
+ size="md"
+ />
+
+ {/* Publish / Cancel buttons */}
+ <div
+ style={{
+ display: 'flex',
+ flexDirection: 'column' as const,
+ gap: 8,
+ marginTop: 'auto',
+ }}>
+ <XDSText
+ type="supporting"
+ color="secondary"
+ style={{textAlign: 'center' as const}}>
+ Your template will go through a review process before appearing in
+ the community grid.{' '}
+ <XDSLink
+ label="Learn more"
+ href="#"
+ onClick={e => e.preventDefault()}>
+ Learn more
+ </XDSLink>
+ </XDSText>
+ <XDSButton
+ variant="primary"
+ label="Submit template"
+ size="lg"
+ onClick={onPublish}
+ style={{width: '100%'}}
+ />
+ <XDSButton
+ variant="secondary"
+ label="Go back to editing"
+ size="lg"
+ onClick={onBack}
+ style={{width: '100%'}}
+ />
+ </div>
</div>
- </div>
</>
);
}
diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/LogoNav.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/LogoNav.tsx
deleted file mode 100644
index 34cfee9275..0000000000
--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/LogoNav.tsx
+++ /dev/null
@@ -1,130 +0,0 @@
-'use client';
-
-import React, {useState} from 'react';
-import {XDSText} from '@xds/core/Text';
-
-const NAV_ITEMS: {key: 'craft' | 'explore' | 'docs' | 'profile'; label: string}[] = [
- {key: 'craft', label: 'Craft'},
- {key: 'docs', label: 'Library'},
-];
-
-export const XDS_LOGO_PLAIN = (
- <div
- style={{
- display: 'flex',
- alignItems: 'center',
- gap: 8,
- cursor: 'pointer',
- }}>
- <svg
- width="20"
- height="20"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- strokeWidth={2}
- strokeLinecap="round"
- strokeLinejoin="round">
- <line x1="4" y1="9" x2="20" y2="9" />
- <line x1="4" y1="15" x2="20" y2="15" />
- </svg>
- <svg
- width="46"
- height="24"
- viewBox="0 0 46 24"
- fill="none"
- xmlns="http://www.w3.org/2000/svg">
- <path
- d="M2.4239 15.8011C2.03945 16.3796 1.66972 16.9538 1.3147 17.524C0.707427 18.4992 1.42354 19.7348 2.57241 19.7348C3.13302 19.7348 3.64463 19.4209 3.91525 18.93C4.29391 18.243 4.71274 17.5352 5.17173 16.8066C5.38894 16.4618 5.60743 16.12 5.82721 15.7812C6.25251 15.1254 6.46516 14.7976 6.76252 14.68C6.99255 14.5891 7.27368 14.5899 7.50317 14.6822C7.79984 14.8014 8.00881 15.1278 8.42675 15.7804C8.64287 16.1179 8.85732 16.46 9.07008 16.8066C9.52175 17.534 9.93823 18.2339 10.3195 18.9063C10.6075 19.4141 11.1428 19.7348 11.7266 19.7348C12.9476 19.7348 13.7063 18.4203 13.0547 17.3877C12.7332 16.8781 12.3991 16.3639 12.0525 15.8453C11.3983 14.8527 10.7379 13.8906 10.0714 12.9592C9.81687 12.6036 9.68962 12.4258 9.64377 12.2384C9.60589 12.0836 9.60492 11.9307 9.64085 11.7754C9.68435 11.5874 9.80856 11.4091 10.057 11.0526C10.7093 10.1164 11.3596 9.15781 12.0078 8.1768C12.3869 7.60474 12.7521 7.03681 13.1035 6.47298C13.71 5.49987 12.9962 4.26519 11.8496 4.26519C11.2943 4.26519 10.7868 4.57405 10.5169 5.05923C10.1399 5.73688 9.72461 6.43721 9.27114 7.16022C9.06143 7.49458 8.8505 7.82569 8.63835 8.15358C8.21478 8.80819 8.003 9.1355 7.70554 9.25334C7.47561 9.34442 7.19397 9.34375 6.96448 9.25156C6.66759 9.13229 6.45853 8.80578 6.04043 8.15276C5.83116 7.82591 5.62351 7.49506 5.41747 7.16022C4.97918 6.44793 4.5738 5.76096 4.20132 5.0993C3.9136 4.58821 3.37617 4.26519 2.78967 4.26519C1.56624 4.26519 0.805692 5.58299 1.45419 6.62041C1.76588 7.11903 2.08912 7.6231 2.4239 8.1326C3.0752 9.10994 3.73263 10.059 4.3962 10.9796C4.65373 11.337 4.7825 11.5156 4.82882 11.7042C4.86709 11.86 4.86797 12.0139 4.83149 12.1702C4.78732 12.3593 4.66122 12.5385 4.40903 12.897C3.74526 13.8406 3.08355 14.8086 2.4239 15.8011Z"
- fill="currentColor"
- />
- <path
- fillRule="evenodd"
- clipRule="evenodd"
- d="M22.4734 4.26519C20.4471 4.26519 19.434 4.26519 18.6657 4.67201C18.0456 5.00031 17.5385 5.50739 17.2102 6.12744C16.8034 6.89579 16.8034 7.90892 16.8034 9.9352V14.0648C16.8034 16.0911 16.8034 17.1042 17.2102 17.8726C17.5385 18.4926 18.0456 18.9997 18.6657 19.328C19.434 19.7348 20.4471 19.7348 22.4734 19.7348H23.2039C24.8496 19.7348 26.2644 19.4033 27.4485 18.7403C28.6399 18.07 29.5559 17.1529 30.1963 15.989C30.8367 14.825 31.1569 13.4954 31.1569 12C31.1569 10.5046 30.8367 9.17495 30.1963 8.01105C29.5559 6.84714 28.6399 5.9337 27.4485 5.27072C26.2644 4.60037 24.8496 4.26519 23.2039 4.26519H22.4734ZM20.0092 8.74707C20.0092 8.16814 20.0092 7.87867 20.1255 7.65914C20.2193 7.48198 20.3641 7.33711 20.5413 7.24331C20.7608 7.12707 21.0503 7.12707 21.6292 7.12707H23.1927C24.6522 7.12707 25.7916 7.57274 26.6107 8.46409C27.4299 9.34807 27.8394 10.5267 27.8394 12C27.8394 13.4659 27.4299 14.6446 26.6107 15.5359C25.7916 16.4273 24.6522 16.8729 23.1927 16.8729H21.6292C21.0503 16.8729 20.7608 16.8729 20.5413 16.7567C20.3641 16.6629 20.2193 16.518 20.1255 16.3409C20.0092 16.1213 20.0092 15.8319 20.0092 15.2529V8.74707Z"
- fill="currentColor"
- />
- <path
- d="M35.4666 19.2376C36.6134 19.7459 37.9501 20 39.4767 20H39.8006C41.7144 20 43.2261 19.5801 44.3357 18.7403C45.4452 17.9006 46 16.7403 46 15.2597C46 14.3757 45.8213 13.6501 45.4638 13.0829C45.1064 12.5083 44.6559 12.0589 44.1123 11.7348C43.5761 11.4033 43.0325 11.1565 42.4814 10.9945C41.9304 10.8324 41.4575 10.7145 41.0628 10.6409L38.706 10.1878C38.0283 10.0552 37.4698 9.87477 37.0305 9.64641C36.5985 9.41068 36.3826 9.02762 36.3826 8.49724C36.3826 7.96685 36.6395 7.55064 37.1533 7.24862C37.6671 6.93923 38.3857 6.78453 39.3091 6.78453H39.6219C40.3964 6.78453 41.1224 6.93186 41.8001 7.22652C42.0982 7.35474 42.3899 7.5234 42.6754 7.73251C43.326 8.20923 44.2444 8.27802 44.8243 7.71734C45.34 7.21868 45.4053 6.39786 44.8761 5.91349C44.3498 5.43171 43.7638 5.03698 43.1181 4.72928C42.1054 4.24309 40.9511 4 39.6554 4H39.3315C38.0953 4 37.0156 4.19521 36.0922 4.58564C35.1762 4.97606 34.4613 5.52486 33.9475 6.23204C33.4411 6.93186 33.188 7.76059 33.188 8.71823C33.188 9.49171 33.3406 10.1436 33.6459 10.674C33.9587 11.2044 34.3571 11.6354 34.8411 11.9669C35.3326 12.2983 35.8539 12.5599 36.4049 12.7514C36.956 12.9355 37.4698 13.0718 37.9464 13.1602L40.3033 13.6243C40.6905 13.698 41.074 13.8011 41.4538 13.9337C41.841 14.0589 42.1612 14.2431 42.4144 14.4862C42.6676 14.7293 42.7942 15.0608 42.7942 15.4807C42.7942 16.6151 41.7814 17.1823 39.7559 17.1823H39.4432C38.49 17.1823 37.615 17.0055 36.8182 16.6519C36.4847 16.4994 36.1665 16.3134 35.8635 16.0938C35.17 15.5911 34.1857 15.5241 33.5784 16.1282C33.0651 16.6388 32.9912 17.4631 33.5198 17.9578C34.0797 18.4818 34.7287 18.9083 35.4666 19.2376Z"
- fill="currentColor"
- />
- </svg>
- </div>
-);
-
-export default function LogoNav({
- activeView,
- setActiveView,
- logo,
-}: {
- activeView: string;
- setActiveView: (view: 'craft' | 'explore' | 'docs' | 'profile') => void;
- logo?: React.ReactNode;
-}) {
- const [isOpen, setIsOpen] = useState(false);
- const [hoveredItem, setHoveredItem] = useState<string | null>(null);
-
- return (
- <div
- style={{position: 'relative'}}
- onMouseEnter={() => setIsOpen(true)}
- onMouseLeave={() => {
- setIsOpen(false);
- setHoveredItem(null);
- }}>
- <div style={{cursor: 'pointer'}}>{logo || XDS_LOGO_PLAIN}</div>
- {isOpen && (
- <div
- style={{
- position: 'absolute',
- top: -8,
- left: -16,
- backgroundColor: 'var(--color-background-card, white)',
- borderRadius: 16,
- boxShadow: '0 4px 24px rgba(0,0,0,0.12)',
- padding: 8,
- minWidth: 200,
- zIndex: 100,
- }}>
- <div style={{marginBottom: 12, paddingLeft: 8, paddingRight: 8}}>
- {logo || XDS_LOGO_PLAIN}
- </div>
- <div
- style={{
- display: 'flex',
- flexDirection: 'column',
- gap: 2,
- }}>
- {NAV_ITEMS.map(item => {
- const isActive = activeView === item.key;
- const isHovered = hoveredItem === item.key;
- return (
- <div
- key={item.key}
- onClick={() => setActiveView(item.key)}
- onMouseEnter={() => setHoveredItem(item.key)}
- onMouseLeave={() => setHoveredItem(null)}
- style={{
- padding: '8px 12px',
- borderRadius: 8,
- cursor: 'pointer',
- backgroundColor:
- isActive || isHovered
- ? 'var(--color-background-body, #f1f4f7)'
- : 'transparent',
- transition: 'background-color 150ms ease',
- }}>
- <XDSText
- type="body"
- weight={isActive ? 'semibold' : 'normal'}>
- {item.label}
- </XDSText>
- </div>
- );
- })}
- </div>
- </div>
- )}
- </div>
- );
-}
diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/ProfileView.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/ProfileView.tsx
index 0e911e009e..5953c0bef5 100644
--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/ProfileView.tsx
+++ b/apps/sandbox/src/app/(fullscreen)/pages/docsite/ProfileView.tsx
@@ -1,13 +1,18 @@
'use client';
import React, {useState} from 'react';
+import {XDSAppShell} from '@xds/core/AppShell';
+import {XDSTopNav, XDSTopNavHeading} from '@xds/core/TopNav';
import {XDSTabList, XDSTab} from '@xds/core/TabList';
import {XDSHeading, XDSText} from '@xds/core/Text';
import {XDSButton} from '@xds/core/Button';
+import {XDSStack} from '@xds/core/Layout';
import {XDSCard} from '@xds/core/Card';
import {XDSAvatar} from '@xds/core/Avatar';
import {XDSBadge} from '@xds/core/Badge';
+import {XDSList, XDSListItem} from '@xds/core/List';
import {XDSDialog, XDSDialogHeader} from '@xds/core/Dialog';
+import {XDSCommandPalette} from '@xds/core/CommandPalette';
import {
PROFILE_USED_ITEMS,
@@ -15,6 +20,7 @@ import {
PROFILE_COLLECTIONS,
DUMMY_IMAGE,
AVATAR_IMAGE,
+ SEARCH_COMMANDS,
} from './constants';
import {
SearchIcon,
@@ -24,7 +30,30 @@ import {
FolderIcon,
DownloadIcon,
} from './docsite-icons';
-import LogoNav from './LogoNav';
+
+const XDS_WORDMARK = (
+ <svg
+ width="46"
+ height="24"
+ viewBox="0 0 46 24"
+ fill="none"
+ xmlns="http://www.w3.org/2000/svg">
+ <path
+ d="M2.4239 15.8011C2.03945 16.3796 1.66972 16.9538 1.3147 17.524C0.707427 18.4992 1.42354 19.7348 2.57241 19.7348C3.13302 19.7348 3.64463 19.4209 3.91525 18.93C4.29391 18.243 4.71274 17.5352 5.17173 16.8066C5.38894 16.4618 5.60743 16.12 5.82721 15.7812C6.25251 15.1254 6.46516 14.7976 6.76252 14.68C6.99255 14.5891 7.27368 14.5899 7.50317 14.6822C7.79984 14.8014 8.00881 15.1278 8.42675 15.7804C8.64287 16.1179 8.85732 16.46 9.07008 16.8066C9.52175 17.534 9.93823 18.2339 10.3195 18.9063C10.6075 19.4141 11.1428 19.7348 11.7266 19.7348C12.9476 19.7348 13.7063 18.4203 13.0547 17.3877C12.7332 16.8781 12.3991 16.3639 12.0525 15.8453C11.3983 14.8527 10.7379 13.8906 10.0714 12.9592C9.81687 12.6036 9.68962 12.4258 9.64377 12.2384C9.60589 12.0836 9.60492 11.9307 9.64085 11.7754C9.68435 11.5874 9.80856 11.4091 10.057 11.0526C10.7093 10.1164 11.3596 9.15781 12.0078 8.1768C12.3869 7.60474 12.7521 7.03681 13.1035 6.47298C13.71 5.49987 12.9962 4.26519 11.8496 4.26519C11.2943 4.26519 10.7868 4.57405 10.5169 5.05923C10.1399 5.73688 9.72461 6.43721 9.27114 7.16022C9.06143 7.49458 8.8505 7.82569 8.63835 8.15358C8.21478 8.80819 8.003 9.1355 7.70554 9.25334C7.47561 9.34442 7.19397 9.34375 6.96448 9.25156C6.66759 9.13229 6.45853 8.80578 6.04043 8.15276C5.83116 7.82591 5.62351 7.49506 5.41747 7.16022C4.97918 6.44793 4.5738 5.76096 4.20132 5.0993C3.9136 4.58821 3.37617 4.26519 2.78967 4.26519C1.56624 4.26519 0.805692 5.58299 1.45419 6.62041C1.76588 7.11903 2.08912 7.6231 2.4239 8.1326C3.0752 9.10994 3.73263 10.059 4.3962 10.9796C4.65373 11.337 4.7825 11.5156 4.82882 11.7042C4.86709 11.86 4.86797 12.0139 4.83149 12.1702C4.78732 12.3593 4.66122 12.5385 4.40903 12.897C3.74526 13.8406 3.08355 14.8086 2.4239 15.8011Z"
+ fill="currentColor"
+ />
+ <path
+ fillRule="evenodd"
+ clipRule="evenodd"
+ d="M22.4734 4.26519C20.4471 4.26519 19.434 4.26519 18.6657 4.67201C18.0456 5.00031 17.5385 5.50739 17.2102 6.12744C16.8034 6.89579 16.8034 7.90892 16.8034 9.9352V14.0648C16.8034 16.0911 16.8034 17.1042 17.2102 17.8726C17.5385 18.4926 18.0456 18.9997 18.6657 19.328C19.434 19.7348 20.4471 19.7348 22.4734 19.7348H23.2039C24.8496 19.7348 26.2644 19.4033 27.4485 18.7403C28.6399 18.07 29.5559 17.1529 30.1963 15.989C30.8367 14.825 31.1569 13.4954 31.1569 12C31.1569 10.5046 30.8367 9.17495 30.1963 8.01105C29.5559 6.84714 28.6399 5.9337 27.4485 5.27072C26.2644 4.60037 24.8496 4.26519 23.2039 4.26519H22.4734ZM20.0092 8.74707C20.0092 8.16814 20.0092 7.87867 20.1255 7.65914C20.2193 7.48198 20.3641 7.33711 20.5413 7.24331C20.7608 7.12707 21.0503 7.12707 21.6292 7.12707H23.1927C24.6522 7.12707 25.7916 7.57274 26.6107 8.46409C27.4299 9.34807 27.8394 10.5267 27.8394 12C27.8394 13.4659 27.4299 14.6446 26.6107 15.5359C25.7916 16.4273 24.6522 16.8729 23.1927 16.8729H21.6292C21.0503 16.8729 20.7608 16.8729 20.5413 16.7567C20.3641 16.6629 20.2193 16.518 20.1255 16.3409C20.0092 16.1213 20.0092 15.8319 20.0092 15.2529V8.74707Z"
+ fill="currentColor"
+ />
+ <path
+ d="M35.4666 19.2376C36.6134 19.7459 37.9501 20 39.4767 20H39.8006C41.7144 20 43.2261 19.5801 44.3357 18.7403C45.4452 17.9006 46 16.7403 46 15.2597C46 14.3757 45.8213 13.6501 45.4638 13.0829C45.1064 12.5083 44.6559 12.0589 44.1123 11.7348C43.5761 11.4033 43.0325 11.1565 42.4814 10.9945C41.9304 10.8324 41.4575 10.7145 41.0628 10.6409L38.706 10.1878C38.0283 10.0552 37.4698 9.87477 37.0305 9.64641C36.5985 9.41068 36.3826 9.02762 36.3826 8.49724C36.3826 7.96685 36.6395 7.55064 37.1533 7.24862C37.6671 6.93923 38.3857 6.78453 39.3091 6.78453H39.6219C40.3964 6.78453 41.1224 6.93186 41.8001 7.22652C42.0982 7.35474 42.3899 7.5234 42.6754 7.73251C43.326 8.20923 44.2444 8.27802 44.8243 7.71734C45.34 7.21868 45.4053 6.39786 44.8761 5.91349C44.3498 5.43171 43.7638 5.03698 43.1181 4.72928C42.1054 4.24309 40.9511 4 39.6554 4H39.3315C38.0953 4 37.0156 4.19521 36.0922 4.58564C35.1762 4.97606 34.4613 5.52486 33.9475 6.23204C33.4411 6.93186 33.188 7.76059 33.188 8.71823C33.188 9.49171 33.3406 10.1436 33.6459 10.674C33.9587 11.2044 34.3571 11.6354 34.8411 11.9669C35.3326 12.2983 35.8539 12.5599 36.4049 12.7514C36.956 12.9355 37.4698 13.0718 37.9464 13.1602L40.3033 13.6243C40.6905 13.698 41.074 13.8011 41.4538 13.9337C41.841 14.0589 42.1612 14.2431 42.4144 14.4862C42.6676 14.7293 42.7942 15.0608 42.7942 15.4807C42.7942 16.6151 41.7814 17.1823 39.7559 17.1823H39.4432C38.49 17.1823 37.615 17.0055 36.8182 16.6519C36.4847 16.4994 36.1665 16.3134 35.8635 16.0938C35.17 15.5911 34.1857 15.5241 33.5784 16.1282C33.0651 16.6388 32.9912 17.4631 33.5198 17.9578C34.0797 18.4818 34.7287 18.9083 35.4666 19.2376Z"
+ fill="currentColor"
+ />
+ </svg>
+);
// ---------------------------------------------------------------------------
// Section Label Component (for DocsView sidebar)
@@ -80,375 +109,377 @@ export function DialogPreview() {
// ---------------------------------------------------------------------------
export function ProfileView({
- activeView,
+ activeView: _activeView,
setActiveView,
}: {
activeView: 'craft' | 'explore' | 'docs' | 'profile';
setActiveView: (v: 'craft' | 'explore' | 'docs' | 'profile') => void;
}) {
const [profileTab, setProfileTab] = useState('used');
- const [expandedCollection, setExpandedCollection] = useState(null as string | null);
+ const [expandedCollection, setExpandedCollection] = useState(
+ null as string | null,
+ );
+ const [isSearchOpen, setIsSearchOpen] = useState(false);
+
+ const headingMenu = (
+ <XDSList density="spacious" style={{minWidth: 240}}>
+ <XDSListItem label="Craft" onClick={() => setActiveView('craft')} />
+ <XDSListItem label="Library" onClick={() => setActiveView('docs')} />
+ </XDSList>
+ );
return (
- <div
- style={{
- display: 'flex',
- flexDirection: 'column' as const,
- height: '100vh',
- backgroundColor: 'var(--color-background-surface, #ffffff)',
- fontFamily: 'system-ui, -apple-system, sans-serif',
- }}>
- {/* Top Nav */}
- <nav
- style={{
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'space-between',
- height: 48,
- padding: '0 16px',
- flexShrink: 0,
- }}>
- <div style={{display: 'flex', alignItems: 'center', gap: 8}}>
- <LogoNav activeView={activeView} setActiveView={setActiveView} />
- </div>
- <div style={{display: 'flex', alignItems: 'center', gap: 4}}>
- <XDSButton
- label="Search"
- variant="ghost"
- size="sm"
- isIconOnly
- icon={<SearchIcon />}
- />
- <XDSButton
- label="Profile"
- variant="ghost"
- size="sm"
- isIconOnly
- icon={<ProfileIcon />}
+ <>
+ <XDSAppShell
+ variant="surface"
+ height="fill"
+ topNav={
+ <XDSTopNav
+ label="XDS navigation"
+ heading={
+ <XDSTopNavHeading
+ logo={XDS_WORDMARK}
+ headingHref="/pages/docsite/"
+ menu={headingMenu}
+ />
+ }
+ endContent={
+ <XDSStack direction="horizontal" gap={2}>
+ <XDSButton
+ label="Search"
+ variant="ghost"
+ isIconOnly
+ icon={<SearchIcon />}
+ onClick={() => setIsSearchOpen(true)}
+ />
+ <XDSButton
+ label="Profile"
+ variant="ghost"
+ isIconOnly
+ icon={<ProfileIcon />}
+ onClick={() => setActiveView('profile')}
+ />
+ </XDSStack>
+ }
/>
- </div>
- </nav>
-
- {/* Scrollable content */}
- <div
- style={{
- flex: 1,
- overflowY: 'auto' as const,
- padding: '40px 48px 64px',
- }}>
- <div style={{maxWidth: 800, margin: '0 auto'}}>
- {/* Profile Header */}
- <div
- style={{
- display: 'flex',
- alignItems: 'center',
- gap: 20,
- marginBottom: 24,
- }}>
- <XDSAvatar name="Ruby Cheung" size="large" src={AVATAR_IMAGE} />
- <div>
- <XDSHeading level={1}>Ruby Cheung</XDSHeading>
- <XDSText type="supporting" color="secondary">
- Design Systems Engineer
- </XDSText>
- <XDSText type="supporting" color="secondary">
- Joined March 2026
- </XDSText>
- <div style={{marginTop: 8}}>
+ }>
+ <div
+ style={{
+ padding: '40px 48px 64px',
+ }}>
+ <div style={{maxWidth: 800, margin: '0 auto'}}>
+ {/* Profile Header */}
+ <XDSStack
+ direction="horizontal"
+ gap={5}
+ vAlign="center"
+ style={{marginBottom: 24}}>
+ <XDSAvatar name="Ruby Cheung" size="large" src={AVATAR_IMAGE} />
+ <div>
+ <XDSHeading level={1}>Ruby Cheung</XDSHeading>
<XDSText type="supporting" color="secondary">
- 12 used · 8 liked · 3 collections
+ Design Systems Engineer
</XDSText>
+ <XDSText type="supporting" color="secondary">
+ Joined March 2026
+ </XDSText>
+ <div style={{marginTop: 8}}>
+ <XDSText type="supporting" color="secondary">
+ 12 used · 8 liked · 3 collections
+ </XDSText>
+ </div>
</div>
- </div>
- </div>
+ </XDSStack>
- {/* Tabs */}
- <div style={{marginBottom: 24}}>
- <XDSTabList value={profileTab} onChange={setProfileTab} size="sm">
- <XDSTab value="used" label="Used" />
- <XDSTab value="liked" label="Liked" />
- <XDSTab value="bookmarks" label="Bookmarks" />
- <XDSTab value="created" label="Created" />
- </XDSTabList>
- </div>
-
- {/* Tab Content: Used */}
- {profileTab === 'used' && (
- <div
- style={{
- display: 'grid',
- gridTemplateColumns: 'repeat(4, 1fr)',
- gap: 16,
- }}>
- {PROFILE_USED_ITEMS.map(item => (
- <XDSCard key={item.name}>
- <div style={{padding: 0}}>
- <div
- style={{
- width: '100%',
- aspectRatio: '4/3',
- backgroundColor:
- 'var(--color-background-body, #f1f4f7)',
- borderRadius: '8px 8px 0 0',
- }}
- />
- <div style={{padding: 12}}>
- <XDSText type="body">{item.name}</XDSText>
- <XDSText type="supporting" color="secondary">
- {item.lastUsed}
- </XDSText>
- </div>
- </div>
- </XDSCard>
- ))}
- </div>
- )}
-
- {/* Tab Content: Liked */}
- {profileTab === 'liked' && (
- <div
- style={{
- display: 'grid',
- gridTemplateColumns: 'repeat(4, 1fr)',
- gap: 16,
- }}>
- {PROFILE_LIKED_ITEMS.map(item => (
- <XDSCard key={item.name}>
- <div style={{padding: 0}}>
- <div
- style={{
- width: '100%',
- aspectRatio: '4/3',
- backgroundColor:
- 'var(--color-background-body, #f1f4f7)',
- borderRadius: '8px 8px 0 0',
- }}
- />
- <div style={{padding: 12}}>
- <XDSText type="body">{item.name}</XDSText>
- <XDSText type="supporting" color="secondary">
- {item.lastUsed}
- </XDSText>
- </div>
- </div>
- </XDSCard>
- ))}
+ {/* Tabs */}
+ <div style={{marginBottom: 24}}>
+ <XDSTabList value={profileTab} onChange={setProfileTab} size="sm">
+ <XDSTab value="used" label="Used" />
+ <XDSTab value="liked" label="Liked" />
+ <XDSTab value="bookmarks" label="Bookmarks" />
+ <XDSTab value="created" label="Created" />
+ </XDSTabList>
</div>
- )}
- {/* Tab Content: Bookmarks */}
- {profileTab === 'bookmarks' && (
- <div>
- <div style={{marginBottom: 16}}>
- <XDSButton
- label="New collection"
- variant="secondary"
- icon={<PlusIcon />}>
- New collection
- </XDSButton>
- </div>
+ {/* Tab Content: Used */}
+ {profileTab === 'used' && (
<div
style={{
display: 'grid',
- gridTemplateColumns: 'repeat(3, 1fr)',
+ gridTemplateColumns: 'repeat(4, 1fr)',
gap: 16,
- marginBottom: 24,
}}>
- {PROFILE_COLLECTIONS.map(collection => (
- <XDSCard key={collection.name}>
- <div style={{padding: 16}}>
+ {PROFILE_USED_ITEMS.map(item => (
+ <XDSCard key={item.name}>
+ <div style={{padding: 0}}>
<div
style={{
- display: 'flex',
- alignItems: 'center',
- gap: 8,
- marginBottom: 8,
- }}>
- <FolderIcon width={20} height={20} />
- <XDSText type="body">{collection.name}</XDSText>
- </div>
- <XDSText type="supporting" color="secondary">
- {collection.count} items
- </XDSText>
- <div
- style={{
- display: 'grid',
- gridTemplateColumns: '1fr 1fr',
- gap: 4,
- marginTop: 12,
- }}>
- {[0, 1, 2, 3].map(i => (
- <div
- key={i}
- style={{
- aspectRatio: '1',
- backgroundColor:
- 'var(--color-background-body, #f1f4f7)',
- borderRadius: 4,
- }}
- />
- ))}
+ width: '100%',
+ aspectRatio: '4/3',
+ backgroundColor:
+ 'var(--color-background-body, #f1f4f7)',
+ borderRadius: '8px 8px 0 0',
+ }}
+ />
+ <div style={{padding: 12}}>
+ <XDSText type="body">{item.name}</XDSText>
+ <XDSText type="supporting" color="secondary">
+ {item.lastUsed}
+ </XDSText>
</div>
</div>
</XDSCard>
))}
</div>
+ )}
- {/* Expandable list */}
- {PROFILE_COLLECTIONS.map(collection => (
- <div key={collection.name} style={{marginBottom: 8}}>
- <XDSButton
- label={collection.name}
- variant="ghost"
- size="sm"
- icon={
- <ChevronDownIcon
- style={{
- transform:
- expandedCollection === collection.name
- ? 'rotate(180deg)'
- : 'rotate(0deg)',
- transition: 'transform 200ms',
- }}
- />
- }
- onClick={() =>
- setExpandedCollection(
- expandedCollection === collection.name
- ? null
- : collection.name,
- )
- }>
- {collection.name} ({collection.count})
- </XDSButton>
- {expandedCollection === collection.name && (
- <div style={{paddingLeft: 32, paddingTop: 8}}>
- {Array.from({length: collection.count}, (_, i) => (
- <div key={i} style={{padding: '4px 0'}}>
- <XDSText type="supporting" color="secondary">
- Item {i + 1}
- </XDSText>
- </div>
- ))}
- </div>
- )}
- </div>
- ))}
- </div>
- )}
-
- {/* Tab Content: Created */}
- {profileTab === 'created' && (
- <div>
- <div
- style={{
- display: 'flex',
- justifyContent: 'flex-end',
- marginBottom: 16,
- }}>
- <XDSButton
- label="Create new"
- variant="secondary"
- size="sm"
- icon={<PlusIcon />}>
- Create new
- </XDSButton>
- </div>
+ {/* Tab Content: Liked */}
+ {profileTab === 'liked' && (
<div
style={{
display: 'grid',
gridTemplateColumns: 'repeat(4, 1fr)',
gap: 16,
}}>
- {[
- {
- name: 'My Dashboard Theme',
- type: 'Theme',
- status: 'Published',
- downloads: '342',
- img: DUMMY_IMAGE,
- },
- {
- name: 'Custom Login Template',
- type: 'Template',
- status: 'Published',
- downloads: '128',
- img: DUMMY_IMAGE,
- },
- {
- name: 'Internal Tools Kit',
- type: 'Template',
- status: 'Draft',
- downloads: '0',
- img: DUMMY_IMAGE,
- },
- ].map((item, i) => (
- <XDSCard key={i} padding={0}>
- <img
- src={item.img}
- alt={item.name}
- style={{
- display: 'block',
- width: '100%',
- height: 140,
- objectFit: 'cover',
- }}
- />
- <div style={{padding: '12px 16px'}}>
+ {PROFILE_LIKED_ITEMS.map(item => (
+ <XDSCard key={item.name}>
+ <div style={{padding: 0}}>
<div
style={{
- display: 'flex',
- alignItems: 'center',
- gap: 8,
- marginBottom: 4,
- }}>
- <XDSText type="body" weight="bold">
- {item.name}
+ width: '100%',
+ aspectRatio: '4/3',
+ backgroundColor:
+ 'var(--color-background-body, #f1f4f7)',
+ borderRadius: '8px 8px 0 0',
+ }}
+ />
+ <div style={{padding: 12}}>
+ <XDSText type="body">{item.name}</XDSText>
+ <XDSText type="supporting" color="secondary">
+ {item.lastUsed}
</XDSText>
</div>
- <div
- style={{
- display: 'flex',
- alignItems: 'center',
- gap: 8,
- marginBottom: 4,
- }}>
- <XDSBadge
- label={item.status}
- variant={
- item.status === 'Published' ? 'success' : 'neutral'
- }
- />
+ </div>
+ </XDSCard>
+ ))}
+ </div>
+ )}
+
+ {/* Tab Content: Bookmarks */}
+ {profileTab === 'bookmarks' && (
+ <div>
+ <div style={{marginBottom: 16}}>
+ <XDSButton
+ label="New collection"
+ variant="secondary"
+ icon={<PlusIcon />}>
+ New collection
+ </XDSButton>
+ </div>
+ <div
+ style={{
+ display: 'grid',
+ gridTemplateColumns: 'repeat(3, 1fr)',
+ gap: 16,
+ marginBottom: 24,
+ }}>
+ {PROFILE_COLLECTIONS.map(collection => (
+ <XDSCard key={collection.name}>
+ <div style={{padding: 16}}>
+ <XDSStack
+ direction="horizontal"
+ gap={2}
+ vAlign="center"
+ style={{marginBottom: 8}}>
+ <FolderIcon width={20} height={20} />
+ <XDSText type="body">{collection.name}</XDSText>
+ </XDSStack>
<XDSText type="supporting" color="secondary">
- {item.type}
+ {collection.count} items
</XDSText>
- </div>
- {item.status === 'Published' && (
<div
style={{
- display: 'flex',
- alignItems: 'center',
+ display: 'grid',
+ gridTemplateColumns: '1fr 1fr',
gap: 4,
- marginTop: 4,
+ marginTop: 12,
}}>
- <DownloadIcon
- width={14}
- height={14}
- style={{opacity: 0.4}}
+ {[0, 1, 2, 3].map(i => (
+ <div
+ key={i}
+ style={{
+ aspectRatio: '1',
+ backgroundColor:
+ 'var(--color-background-body, #f1f4f7)',
+ borderRadius: 4,
+ }}
+ />
+ ))}
+ </div>
+ </div>
+ </XDSCard>
+ ))}
+ </div>
+
+ {/* Expandable list */}
+ {PROFILE_COLLECTIONS.map(collection => (
+ <div key={collection.name} style={{marginBottom: 8}}>
+ <XDSButton
+ label={collection.name}
+ variant="ghost"
+ size="sm"
+ icon={
+ <ChevronDownIcon
+ style={{
+ transform:
+ expandedCollection === collection.name
+ ? 'rotate(180deg)'
+ : 'rotate(0deg)',
+ transition: 'transform 200ms',
+ }}
+ />
+ }
+ onClick={() =>
+ setExpandedCollection(
+ expandedCollection === collection.name
+ ? null
+ : collection.name,
+ )
+ }>
+ {collection.name} ({collection.count})
+ </XDSButton>
+ {expandedCollection === collection.name && (
+ <div style={{paddingLeft: 32, paddingTop: 8}}>
+ {Array.from({length: collection.count}, (_, i) => (
+ <div key={i} style={{padding: '4px 0'}}>
+ <XDSText type="supporting" color="secondary">
+ Item {i + 1}
+ </XDSText>
+ </div>
+ ))}
+ </div>
+ )}
+ </div>
+ ))}
+ </div>
+ )}
+
+ {/* Tab Content: Created */}
+ {profileTab === 'created' && (
+ <div>
+ <div
+ style={{
+ display: 'flex',
+ justifyContent: 'flex-end',
+ marginBottom: 16,
+ }}>
+ <XDSButton
+ label="Create new"
+ variant="secondary"
+ size="sm"
+ icon={<PlusIcon />}>
+ Create new
+ </XDSButton>
+ </div>
+ <div
+ style={{
+ display: 'grid',
+ gridTemplateColumns: 'repeat(4, 1fr)',
+ gap: 16,
+ }}>
+ {[
+ {
+ name: 'My Dashboard Theme',
+ type: 'Theme',
+ status: 'Published',
+ downloads: '342',
+ img: DUMMY_IMAGE,
+ },
+ {
+ name: 'Custom Login Template',
+ type: 'Template',
+ status: 'Published',
+ downloads: '128',
+ img: DUMMY_IMAGE,
+ },
+ {
+ name: 'Internal Tools Kit',
+ type: 'Template',
+ status: 'Draft',
+ downloads: '0',
+ img: DUMMY_IMAGE,
+ },
+ ].map((item, i) => (
+ <XDSCard key={i} padding={0}>
+ <img
+ src={item.img}
+ alt={item.name}
+ style={{
+ display: 'block',
+ width: '100%',
+ height: 140,
+ objectFit: 'cover',
+ }}
+ />
+ <div style={{padding: '12px 16px'}}>
+ <XDSStack
+ direction="horizontal"
+ gap={2}
+ vAlign="center"
+ style={{marginBottom: 4}}>
+ <XDSText type="body" weight="bold">
+ {item.name}
+ </XDSText>
+ </XDSStack>
+ <XDSStack
+ direction="horizontal"
+ gap={2}
+ vAlign="center"
+ style={{marginBottom: 4}}>
+ <XDSBadge
+ label={item.status}
+ variant={
+ item.status === 'Published'
+ ? 'success'
+ : 'neutral'
+ }
/>
<XDSText type="supporting" color="secondary">
- {item.downloads} downloads
+ {item.type}
</XDSText>
- </div>
- )}
- </div>
- </XDSCard>
- ))}
+ </XDSStack>
+ {item.status === 'Published' && (
+ <XDSStack
+ direction="horizontal"
+ gap={1}
+ vAlign="center"
+ style={{marginTop: 4}}>
+ <DownloadIcon
+ width={14}
+ height={14}
+ style={{opacity: 0.4}}
+ />
+ <XDSText type="supporting" color="secondary">
+ {item.downloads} downloads
+ </XDSText>
+ </XDSStack>
+ )}
+ </div>
+ </XDSCard>
+ ))}
+ </div>
</div>
- </div>
- )}
+ )}
+ </div>
</div>
- </div>
- </div>
+ </XDSAppShell>
+
+ <XDSCommandPalette
+ isOpen={isSearchOpen}
+ onOpenChange={setIsSearchOpen}
+ searchSource={SEARCH_COMMANDS}
+ label="Search templates and components"
+ />
+ </>
);
}
diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/SharePopover.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/SharePopover.tsx
index c895f0e464..87c6f7a225 100644
--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/SharePopover.tsx
+++ b/apps/sandbox/src/app/(fullscreen)/pages/docsite/SharePopover.tsx
@@ -5,51 +5,33 @@ import {XDSHeading, XDSText} from '@xds/core/Text';
import {XDSCard} from '@xds/core/Card';
import {XDSCodeBlock} from '@xds/core/CodeBlock';
import {XDSList, XDSListItem} from '@xds/core/List';
+import {XDSStack} from '@xds/core/Layout';
import {ClaudeIcon, VSCodeIcon, CursorAIIcon} from './docsite-icons';
-export function SharePopover({
+export function SharePopoverContent({
cliCommand,
- position,
onClose,
}: {
cliCommand: string;
- position: {top: number; left: number};
onClose: () => void;
}) {
return (
- <div
- data-share-popover
- style={{
- position: 'fixed' as const,
- left: position.left,
- top: position.top,
- zIndex: 100,
- width: 340,
- backgroundColor: 'var(--color-background-card, #fff)',
- borderRadius: 12,
- boxShadow:
- '0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08)',
- padding: 16,
- }}>
- <XDSHeading level={3}>Add to your project</XDSHeading>
- <div style={{marginTop: 0}}>
+ <XDSStack direction="vertical" gap={4}>
+ <XDSStack direction="vertical" gap={0}>
+ <XDSHeading level={3}>Add to your project</XDSHeading>
<XDSText type="body" color="secondary">
Copy this snippet and paste it in your terminal to get started.
</XDSText>
- </div>
+ </XDSStack>
- <div style={{marginTop: 16}}>
- <XDSCard padding={0}>
- <XDSCodeBlock code={cliCommand} language="bash" />
- </XDSCard>
- </div>
+ <XDSCard padding={0}>
+ <XDSCodeBlock code={cliCommand} language="bash" />
+ </XDSCard>
- <div style={{marginTop: 16, marginBottom: 16}}>
- <XDSText type="label" color="secondary">
- Or open in
- </XDSText>
- </div>
- <XDSList style={{margin: '-8px -8px -8px -8px'}}>
+ <XDSText type="label" color="secondary">
+ Or open in
+ </XDSText>
+ <XDSList style={{margin: '-8px'}}>
<XDSListItem
label="Claude Code"
startContent={
@@ -72,6 +54,6 @@ export function SharePopover({
onClick={onClose}
/>
</XDSList>
- </div>
+ </XDSStack>
);
}
diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplateCard.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplateCard.tsx
index 78e0e285e6..0255d0702f 100644
--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplateCard.tsx
+++ b/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplateCard.tsx
@@ -1,13 +1,14 @@
'use client';
-import React, {useState, useEffect, useRef, useCallback} from 'react';
+import React, {useState, useEffect} from 'react';
import {XDSCard} from '@xds/core/Card';
import {XDSButton} from '@xds/core/Button';
import {XDSText} from '@xds/core/Text';
+import {XDSStack} from '@xds/core/Layout';
+import {XDSPopover} from '@xds/core/Popover';
import {BookmarkIcon, BookmarkFilledIcon} from './docsite-icons';
-import {BoidsCanvas} from './BoidsCanvas';
-import type {BoidsSimulation} from './BoidsCanvas';
-import {SharePopover} from './SharePopover';
+import {CraftingCat} from './CraftingCat';
+import {SharePopoverContent} from './SharePopover';
export function TemplateCard({
src,
@@ -18,7 +19,6 @@ export function TemplateCard({
onMoreLikeThis: _onMoreLikeThis,
onUse,
onPreview,
- simulation,
cardSize: _cardSize = 'medium',
}: {
src: string;
@@ -29,33 +29,15 @@ export function TemplateCard({
onMoreLikeThis?: () => void;
onUse: () => void;
onPreview: () => void;
- simulation: BoidsSimulation;
cardSize?: 'xlarge' | 'large' | 'medium' | 'small';
}) {
const [hovered, setHovered] = useState(false);
- const containerRef = useRef(null as HTMLDivElement | null);
- const [size, setSize] = useState({w: 0, h: 0});
const [showCanvas, setShowCanvas] = useState(false);
- const useButtonRef = useRef<HTMLButtonElement>(null);
const [showUsePopover, setShowUsePopover] = useState(false);
const [bookmarked, setBookmarked] = useState(false);
- const [usePopoverPos, setUsePopoverPos] = useState<{
- top: number;
- left: number;
- } | null>(null);
-
- const handleUseClick = useCallback(() => {
- if (useButtonRef.current) {
- const rect = useButtonRef.current.getBoundingClientRect();
- setUsePopoverPos({top: rect.bottom + 8, left: rect.left});
- }
- setShowUsePopover(prev => !prev);
- }, []);
useEffect(() => {
- if (isGenerating && containerRef.current) {
- const rect = containerRef.current.getBoundingClientRect();
- setSize({w: rect.width, h: rect.height});
+ if (isGenerating) {
setShowCanvas(true);
}
}, [isGenerating]);
@@ -71,7 +53,6 @@ export function TemplateCard({
return (
<XDSCard padding={0}>
<div
- ref={containerRef}
style={{
position: 'relative',
cursor: 'pointer',
@@ -87,7 +68,7 @@ export function TemplateCard({
style={{
display: 'block',
width: '100%',
- height: 400,
+ aspectRatio: '1920 / 1205',
objectFit: 'cover' as const,
objectPosition: 'top',
opacity: isGenerating ? 0 : 1,
@@ -100,14 +81,13 @@ export function TemplateCard({
style={{
position: 'absolute',
inset: 0,
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
opacity: isGenerating ? 1 : 0,
transition: 'opacity 600ms ease',
}}>
- <BoidsCanvas
- width={size.w}
- height={size.h}
- simulation={simulation}
- />
+ <CraftingCat />
</div>
)}
{!isGenerating && (
@@ -153,7 +133,7 @@ export function TemplateCard({
justifyContent: 'space-between',
}}>
{/* Template info */}
- <div style={{display: 'flex', flexDirection: 'column', gap: 0}}>
+ <XDSStack direction="vertical" gap={0}>
<XDSText type="body" weight="bold" style={{color: '#fff'}}>
{name}
</XDSText>
@@ -162,17 +142,29 @@ export function TemplateCard({
style={{color: 'rgba(255,255,255,0.7)'}}>
Andrea Anderson
</XDSText>
- </div>
+ </XDSStack>
{/* Action buttons */}
- <div style={{display: 'flex', gap: 8}}>
- <XDSButton
- ref={useButtonRef}
- label="Use"
- variant="secondary"
- size="sm"
- style={{backgroundColor: 'var(--color-background-surface)'}}
- onClick={handleUseClick}
- />
+ <XDSStack direction="horizontal" gap={2}>
+ <XDSPopover
+ label="Add to project"
+ isOpen={showUsePopover}
+ onOpenChange={setShowUsePopover}
+ placement="above"
+ alignment="start"
+ width={340}
+ content={
+ <SharePopoverContent
+ cliCommand={`npx xds template ${name.toLowerCase().replace(/\s+/g, '-')}`}
+ onClose={() => setShowUsePopover(false)}
+ />
+ }>
+ <XDSButton
+ label="Use"
+ variant="secondary"
+ size="sm"
+ style={{backgroundColor: 'var(--color-background-surface)'}}
+ />
+ </XDSPopover>
<XDSButton
label="Craft"
variant="secondary"
@@ -180,14 +172,7 @@ export function TemplateCard({
style={{backgroundColor: 'var(--color-background-surface)'}}
onClick={onUse}
/>
- </div>
- {showUsePopover && usePopoverPos && (
- <SharePopover
- cliCommand={`npx xds template ${name.toLowerCase().replace(/\s+/g, '-')}`}
- position={usePopoverPos}
- onClose={() => setShowUsePopover(false)}
- />
- )}
+ </XDSStack>
</div>
</div>
)}
diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplateFullPreview.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplateFullPreview.tsx
deleted file mode 100644
index 02de3e0c97..0000000000
--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplateFullPreview.tsx
+++ /dev/null
@@ -1,1182 +0,0 @@
-'use client';
-
-import React, {useState, useEffect, useRef, useCallback} from 'react';
-import {XDSHeading, XDSText} from '@xds/core/Text';
-import {XDSButton} from '@xds/core/Button';
-import {XDSCard} from '@xds/core/Card';
-import {XDSAvatar} from '@xds/core/Avatar';
-import {XDSDropdownMenu} from '@xds/core/DropdownMenu';
-import {
- XDSSegmentedControl,
- XDSSegmentedControlItem,
-} from '@xds/core/SegmentedControl';
-import {XDSToken} from '@xds/core/Token';
-import {XDSToolbar} from '@xds/core/Toolbar';
-import {XDSTooltip} from '@xds/core/Tooltip';
-import {XDSDialog, XDSDialogHeader} from '@xds/core/Dialog';
-import {XDSTextInput} from '@xds/core/TextInput';
-
-import {
- ArrowLeftIcon,
- DesktopIcon,
- PhoneIcon,
- CodeIcon,
- CursorIcon,
- PaletteIcon,
- ContrastIcon,
- SaveIcon,
- PlusIcon,
- SendIcon,
- CheckIcon,
- BookmarkIcon,
- BookmarkFilledIcon,
- StarIcon,
- StarFilledIcon,
- SearchIcon,
- MetaLogo,
- WhatsAppLogo,
- ThreadsLogo,
- FacebookLogo,
- DefaultThemeIcon,
- ForestThemeIcon,
- SunsetThemeIcon,
- MidnightThemeIcon,
-} from './docsite-icons';
-import {
- XDS_THEMES,
- MOCK_CODE,
- TEMPLATES,
- THEME_PICKER_ENTRIES,
- PREVIEW_FONT_PACKS,
- AVATAR_IMAGE,
-} from './constants';
-
-import {InlinePublishPanel} from './InlinePublishPanel';
-import {SharePopover} from './SharePopover';
-
-const BRAND_LOGOS: Record<string, React.ComponentType<React.SVGProps<SVGSVGElement>>> = {
- default: DefaultThemeIcon,
- meta: MetaLogo,
- whatsapp: WhatsAppLogo,
- threads: ThreadsLogo,
- facebook: FacebookLogo,
- forest: ForestThemeIcon,
- sunset: SunsetThemeIcon,
- midnight: MidnightThemeIcon,
-};
-
-export function TemplateFullPreview({
- templateName,
- imageSrc,
- onBack,
- onUse,
- onSelectTemplate,
- showChat = false,
- showEditor = false,
- defaultTab = 'properties',
- hideShadows = false,
-}: {
- templateName: string;
- imageSrc: string;
- onBack: () => void;
- onUse: () => void;
- onSelectTemplate?: (index: number) => void;
- showChat?: boolean;
- showEditor?: boolean;
- defaultTab?: 'properties' | 'chat';
- hideShadows?: boolean;
-}) {
- const [viewMode, setViewMode] = useState('desktop' as 'desktop' | 'mobile');
- const [editorView, setEditorView] = useState(
- 'preview' as 'preview' | 'code',
- );
- const [isVisible, setIsVisible] = useState(false);
- const [selectedTheme, setSelectedTheme] = useState('default');
- const [showThemeBrowse, setShowThemeBrowse] = useState(false);
- const [themeSearch, setThemeSearch] = useState('');
- const [pinnedThemes, setPinnedThemes] = useState(
- () => new Set(THEME_PICKER_ENTRIES.filter(t => t.isPinnedByDefault).map(t => t.key)),
- );
- const togglePin = useCallback((key: string) => {
- setPinnedThemes(prev => {
- const next = new Set(prev);
- if (next.has(key)) next.delete(key);
- else next.add(key);
- return next;
- });
- }, []);
- const [selectedFontPack, setSelectedFontPack] = useState(
- PREVIEW_FONT_PACKS[0].heading as string | null,
- );
- const [panelTab, setPanelTab] = useState(
- defaultTab as 'properties' | 'chat',
- );
- const [chatInput, setChatInput] = useState('');
- const [codeContent, setCodeContent] = useState(MOCK_CODE);
- const [showPublishModal, setShowPublishModal] = useState(false);
- const [showSendPopover, setShowSendPopover] = useState(false);
- const [sendPopoverPos, setSendPopoverPos] = useState(
- null as {top: number; left: number} | null,
- );
- const [sendCopied, setSendCopied] = useState(false);
- const [bookmarked, setBookmarked] = useState(false);
- const [bookmarkCount, setBookmarkCount] = useState(892);
- const [showAddPopover, setShowAddPopover] = useState(false);
- const [addPopoverPos, setAddPopoverPos] = useState(null as {top: number; left: number} | null);
- const addButtonRef = useRef(null as HTMLButtonElement | null);
- const addPopoverRef = useRef(null as HTMLDivElement | null);
- const sendPopoverRef = useRef(null as HTMLDivElement | null);
-
- const shareCliCommand = `npx xds template ${templateName.toLowerCase().replace(/\s+/g, '-')} ./my-project`;
-
- useEffect(() => {
- requestAnimationFrame(() => {
- requestAnimationFrame(() => setIsVisible(true));
- });
- }, []);
-
-
- useEffect(() => {
- if (!showSendPopover) return;
- const handleClickOutside = (e: MouseEvent) => {
- if (
- sendPopoverRef.current &&
- !sendPopoverRef.current.contains(e.target as Node)
- ) {
- setShowSendPopover(false);
- }
- };
- document.addEventListener('mousedown', handleClickOutside);
- return () => document.removeEventListener('mousedown', handleClickOutside);
- }, [showSendPopover]);
-
- useEffect(() => {
- if (!showAddPopover) return;
- const handleClickOutside = (e: MouseEvent) => {
- if (
- addPopoverRef.current &&
- !addPopoverRef.current.contains(e.target as Node)
- ) {
- setShowAddPopover(false);
- }
- };
- document.addEventListener('mousedown', handleClickOutside);
- return () => document.removeEventListener('mousedown', handleClickOutside);
- }, [showAddPopover]);
-
- return (
- <div
- style={{
- display: 'flex',
- height: '100vh',
- overflow: 'visible',
- backgroundColor: 'var(--color-background-body, #f5f5f5)',
- }}>
- {/* LEFT PANEL — details sidebar */}
- <div
- style={{
- width: 380,
- flexShrink: 0,
- padding: '16px 0 16px 16px',
- display: 'flex',
- backgroundColor: 'transparent',
- opacity: isVisible ? 1 : 0,
- transform: isVisible ? 'none' : 'translateX(-60px)',
- transition: 'opacity 500ms cubic-bezier(0.16, 1, 0.3, 1) 100ms, transform 500ms cubic-bezier(0.16, 1, 0.3, 1) 100ms',
- }}>
- <div
- style={{
- flex: 1,
- backgroundColor: 'var(--color-background-card, #fff)',
- borderRadius: 16,
- boxShadow: hideShadows ? 'none' : '0 4px 24px rgba(0,0,0,0.08)',
- padding: showChat ? '16px 32px 32px' : '24px 32px 32px',
- overflow: 'visible',
- display: 'flex',
- flexDirection: 'column' as const,
- }}>
- {/* Details / Chat content — hidden when publish is visible */}
- <div
- style={{
- display: showPublishModal ? 'none' : 'flex',
- flexDirection: 'column' as const,
- flex: 1,
- }}>
- {/* Back button + tabs on same row */}
- <div
- style={{
- display: 'flex',
- alignItems: 'center',
- gap: 8,
- marginBottom: showChat ? 32 : 8,
- paddingBottom: 0,
- borderBottom: showChat
- ? '1px solid var(--color-divider, #e0e0e0)'
- : 'none',
- }}>
- <XDSTooltip content="Craft">
- <XDSButton
- label="Craft"
- variant="ghost"
- size="sm"
- icon={<ArrowLeftIcon />}
- isIconOnly={!!showChat}
- onClick={onBack}
- style={{marginLeft: -8, flexShrink: 0}}
- />
- </XDSTooltip>
- {showChat && (
- <div style={{display: 'flex', flex: 1}}>
- {(['properties', 'chat'] as const).map(tab => (
- <button
- key={tab}
- onClick={() => setPanelTab(tab)}
- style={{
- flex: 1,
- padding: '8px 0',
- background: 'none',
- border: 'none',
- borderBottom:
- panelTab === tab
- ? '2px solid var(--color-text-primary, #111)'
- : '2px solid transparent',
- marginBottom: -1,
- cursor: 'pointer',
- textAlign: 'center' as const,
- transition: 'border-color 150ms ease',
- }}>
- <XDSText
- type="body"
- color={panelTab === tab ? 'primary' : 'secondary'}>
- {tab === 'properties' ? 'Details' : 'Chat'}
- </XDSText>
- </button>
- ))}
- </div>
- )}
- </div>
-
- {/* Chat tab content */}
- {showChat && panelTab === 'chat' ? (
- <div
- style={{
- display: 'flex',
- flexDirection: 'column' as const,
- flex: 1,
- minHeight: 0,
- }}>
- {/* Chat messages area */}
- <div style={{flex: 1, overflowY: 'auto' as const}}>
- {/* Welcome message bubble */}
- <div
- style={{
- backgroundColor: 'var(--color-background-body, #f1f4f7)',
- borderRadius: 12,
- padding: 12,
- }}>
- <XDSText type="body">
- Hi! I can help you customize this template. Try asking me
- to change colors, layout, or content.
- </XDSText>
- </div>
- </div>
-
- {/* Composer pinned to bottom */}
- <div
- style={{
- borderTop: '1px solid var(--color-divider, #e0e0e0)',
- padding: 8,
- display: 'flex',
- alignItems: 'center',
- gap: 8,
- margin: '0 -32px -32px -32px',
- paddingInline: 32,
- paddingBottom: 32,
- }}>
- <XDSButton
- label="Attach"
- variant="ghost"
- size="sm"
- isIconOnly
- icon={<PlusIcon />}
- />
- <input
- value={chatInput}
- onChange={e => setChatInput(e.target.value)}
- placeholder="What should we build?"
- style={{
- flex: 1,
- border: 'none',
- outline: 'none',
- backgroundColor: 'transparent',
- fontSize: 14,
- color: 'inherit',
- }}
- />
- <XDSButton
- label="Send"
- variant="primary"
- size="sm"
- isIconOnly
- icon={<SendIcon />}
- style={{borderRadius: 9999}}
- />
- </div>
- </div>
- ) : (
- <>
- {/* Template name — click to copy link */}
- <span
- style={{cursor: 'pointer', textDecoration: 'none'}}
- onMouseEnter={(e: React.MouseEvent<HTMLElement>) => {
- e.currentTarget.style.textDecoration = 'underline';
- }}
- onMouseLeave={(e: React.MouseEvent<HTMLElement>) => {
- e.currentTarget.style.textDecoration = 'none';
- }}
- onClick={() => {
- void navigator.clipboard.writeText(
- 'https://xds.dev/templates/' +
- templateName.toLowerCase().replace(/\s+/g, '-'),
- );
- }}>
- <XDSText type="display-2">
- {templateName}
- </XDSText>
- </span>
-
- {/* Description */}
- <div style={{marginTop: 8}}>
- <XDSText type="body" color="secondary">
- Buttons are clickable elements that are used to trigger
- actions. They communicate calls to action to the user and
- allow users to interact with pages in a variety of ways.
- Button labels express what action will occur when the user
- interacts with it.
- </XDSText>
- </div>
-
- {/* Author section */}
- <div
- style={{
- marginTop: 16,
- display: 'flex',
- flexDirection: 'row' as const,
- alignItems: 'center',
- gap: 12,
- }}>
- <XDSAvatar
- name="Andrea Anderson"
- size={36}
- src={AVATAR_IMAGE}
- />
- <div
- style={{display: 'flex', flexDirection: 'column', gap: 0}}>
- <XDSText type="supporting" color="secondary">
- Crafted by
- </XDSText>
- <XDSText
- type="body"
- style={{fontWeight: 600, fontSize: 16}}>
- Andrea Anderson
- </XDSText>
- </div>
- </div>
-
- {/* CTA buttons */}
- {!showEditor && (
- <div style={{marginTop: 16, display: 'flex', flexDirection: 'column', gap: 8, position: 'relative'}}>
- <div style={{display: 'flex', gap: 8}}>
- <XDSButton
- variant="primary"
- label="Start crafting"
- onClick={onUse}
- size="lg"
- style={{flex: 1}}
- />
- <XDSTooltip content="Bookmark">
- <XDSButton
- label={bookmarkCount.toLocaleString()}
- variant="secondary"
- size="lg"
- isIconOnly
- icon={
- <BookmarkIcon
- fill={bookmarked ? 'currentColor' : 'none'}
- style={
- bookmarked
- ? {color: 'var(--color-icon-highlight, #3b82f6)'}
- : undefined
- }
- />
- }
- onClick={() => {
- setBookmarked(prev => !prev);
- setBookmarkCount(prev =>
- bookmarked ? prev - 1 : prev + 1,
- );
- }}
- />
- </XDSTooltip>
- </div>
- <div ref={addPopoverRef}>
- <XDSButton
- ref={addButtonRef}
- variant="secondary"
- label="Add to your project"
- size="lg"
- style={{width: '100%'}}
- onClick={() => {
- if (addButtonRef.current) {
- const rect = addButtonRef.current.getBoundingClientRect();
- setAddPopoverPos({top: rect.bottom + 8, left: rect.left});
- }
- setShowAddPopover(prev => !prev);
- }}
- />
- {showAddPopover && addPopoverPos && (
- <SharePopover
- cliCommand={shareCliCommand}
- position={addPopoverPos}
- onClose={() => setShowAddPopover(false)}
- />
- )}
- </div>
- </div>
- )}
-
- {/* Themes — pinned grid */}
- <div style={{marginTop: 32}}>
- <div
- style={{
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'space-between',
- }}>
- <XDSHeading level={4}>Apply your themes</XDSHeading>
- <XDSButton
- variant="ghost"
- size="sm"
- label="Browse"
- onClick={() => setShowThemeBrowse(true)}
- />
- </div>
- <div
- style={{
- display: 'grid',
- gridTemplateColumns: 'repeat(auto-fill, 44px)',
- gap: 8,
- marginTop: 12,
- }}>
- {THEME_PICKER_ENTRIES.filter(
- t => pinnedThemes.has(t.key),
- ).map(entry => {
- const isSelected = selectedTheme === entry.key;
- const BrandLogo = BRAND_LOGOS[entry.key];
- return (
- <XDSTooltip key={entry.key} content={entry.name}>
- <div
- onClick={() => setSelectedTheme(entry.key)}
- style={{
- width: 44,
- height: 44,
- borderRadius: 10,
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- cursor: 'pointer',
- border: isSelected
- ? '2px solid var(--color-text-primary, #111)'
- : '2px solid var(--color-border, #E0E0E0)',
- backgroundColor: '#fff',
- transition: 'border-color 0.15s ease',
- }}>
- {BrandLogo ? (
- <BrandLogo width={28} height={28} />
- ) : (
- <div
- style={{
- width: 24,
- height: 24,
- borderRadius: '50%',
- backgroundColor: entry.accent,
- }}
- />
- )}
- </div>
- </XDSTooltip>
- );
- })}
- </div>
- </div>
-
- {/* All themes browse dialog */}
- <XDSDialog
- isOpen={showThemeBrowse}
- onOpenChange={open => {
- setShowThemeBrowse(open);
- if (!open) setThemeSearch('');
- }}
- width={720}>
- <XDSDialogHeader
- title="All Themes"
- onOpenChange={open => {
- setShowThemeBrowse(open);
- if (!open) setThemeSearch('');
- }}
- />
- <div
- style={{
- display: 'flex',
- flexDirection: 'column',
- gap: 16,
- padding: 16,
- }}>
- <XDSTextInput
- label="Search"
- isLabelHidden
- placeholder="Search themes..."
- value={themeSearch}
- onChange={setThemeSearch}
- size="lg"
- startIcon={SearchIcon}
- />
- <div
- style={{
- maxHeight: 560,
- overflowY: 'auto',
- display: 'flex',
- flexDirection: 'column',
- gap: 8,
- }}>
- {(['official', 'community'] as const).map(
- category => {
- const entries = THEME_PICKER_ENTRIES.filter(
- t =>
- t.category === category &&
- t.name
- .toLowerCase()
- .includes(themeSearch.toLowerCase()),
- );
- if (entries.length === 0) return null;
- return (
- <div key={category}>
- <XDSText
- type="supporting"
- color="secondary"
- style={{
- textTransform: 'uppercase',
- letterSpacing: '0.05em',
- marginBottom: 8,
- }}>
- {category}
- </XDSText>
- <div
- style={{
- display: 'grid',
- gridTemplateColumns: '1fr 1fr 1fr',
- gap: 8,
- }}>
- {entries.map(entry => {
- const isSelected =
- selectedTheme === entry.key;
- const isPinned = pinnedThemes.has(
- entry.key,
- );
- const p = entry.preview;
- return (
- <div
- key={entry.key}
- style={{
- borderRadius: 12,
- overflow: 'hidden',
- border: isSelected
- ? '2px solid var(--color-text-primary, #111)'
- : '2px solid var(--color-border, #E0E0E0)',
- cursor: 'pointer',
- transition:
- 'border-color 0.15s ease',
- }}>
- {/* Mini UI mockup */}
- <div
- onClick={() => {
- setSelectedTheme(entry.key);
- setShowThemeBrowse(false);
- setThemeSearch('');
- }}
- style={{
- height: 100,
- backgroundColor: p.bg,
- display: 'flex',
- flexDirection: 'column',
- overflow: 'hidden',
- }}>
- <div
- style={{
- height: 14,
- backgroundColor: p.surface,
- borderBottom: `1px solid ${p.text}1A`,
- display: 'flex',
- alignItems: 'center',
- paddingInline: 8,
- gap: 4,
- }}>
- <div
- style={{
- width: 5,
- height: 5,
- borderRadius: '50%',
- backgroundColor:
- p.accent,
- }}
- />
- <div
- style={{
- width: 16,
- height: 2,
- borderRadius: 1,
- backgroundColor: p.text,
- opacity: 0.3,
- }}
- />
- </div>
- <div
- style={{
- flex: 1,
- padding: 8,
- display: 'flex',
- flexDirection: 'column',
- gap: 5,
- }}>
- <div
- style={{
- width: '65%',
- height: 4,
- borderRadius: 2,
- backgroundColor: p.text,
- opacity: 0.6,
- }}
- />
- <div
- style={{
- width: '45%',
- height: 3,
- borderRadius: 1.5,
- backgroundColor: p.text,
- opacity: 0.25,
- }}
- />
- <div
- style={{
- width: 28,
- height: 10,
- borderRadius: 4,
- backgroundColor:
- p.accent,
- marginTop: 'auto',
- }}
- />
- </div>
- </div>
- {/* Name + logo + pin */}
- <div
- style={{
- display: 'flex',
- alignItems: 'center',
- justifyContent:
- 'space-between',
- padding: '6px 8px',
- backgroundColor:
- 'var(--color-surface, #f5f5f5)',
- }}>
- <div style={{display: 'flex', alignItems: 'center', gap: 6}}>
- {(() => {
- const Logo = BRAND_LOGOS[entry.key];
- return Logo ? <Logo width={14} height={14} /> : (
- <div style={{width: 14, height: 14, borderRadius: '50%', backgroundColor: entry.accent}} />
- );
- })()}
- <XDSText
- type="supporting"
- style={{
- fontWeight: isSelected
- ? 600
- : 400,
- }}>
- {entry.name}
- </XDSText>
- </div>
- <div
- onClick={e => {
- e.stopPropagation();
- togglePin(entry.key);
- }}
- style={{
- cursor: 'pointer',
- display: 'flex',
- padding: 2,
- }}>
- {isPinned ? (
- <StarFilledIcon
- width={14}
- height={14}
- style={{
- color:
- 'var(--color-text-primary, #111)',
- }}
- />
- ) : (
- <StarIcon
- width={14}
- height={14}
- style={{
- color:
- 'var(--color-secondary, #999)',
- }}
- />
- )}
- </div>
- </div>
- </div>
- );
- })}
- </div>
- </div>
- );
- },
- )}
- </div>
- </div>
- </XDSDialog>
-
- {/* Font packs — removed */}
- <div style={{marginTop: 32, display: 'none'}}>
- <XDSHeading level={4}>Font packs</XDSHeading>
- <div
- style={{
- display: 'grid',
- gridTemplateColumns: '1fr 1fr',
- gap: 10,
- marginTop: 8,
- }}>
- {PREVIEW_FONT_PACKS.map(pack => (
- <div
- key={pack.heading}
- onClick={() => setSelectedFontPack(pack.heading)}
- style={{
- cursor: 'pointer',
- border: `2px solid ${selectedFontPack === pack.heading ? 'var(--color-text-primary, #111)' : 'transparent'}`,
- borderRadius: 14,
- overflow: 'hidden',
- transition: 'border-color 0.15s ease',
- }}>
- <XDSCard padding={2}>
- <div style={{fontFamily: pack.heading}}>
- <XDSText
- type="body"
- style={{fontWeight: 600, fontSize: 16}}>
- Heading
- </XDSText>
- </div>
- <div style={{fontFamily: pack.paragraph}}>
- <XDSText type="supporting" color="secondary">
- Paragraph text
- </XDSText>
- </div>
- </XDSCard>
- </div>
- ))}
- </div>
- </div>
-
- {/* Component used */}
- <div style={{marginTop: 32}}>
- <XDSHeading level={3}>Component used</XDSHeading>
- <div
- style={{
- display: 'flex',
- flexWrap: 'wrap' as const,
- gap: 8,
- marginTop: 8,
- }}>
- <XDSToken label="XDSAppShell" />
- <XDSToken label="XDSTopNav" />
- <XDSToken label="XDSVStack" />
- <XDSToken label="XDSHStack" />
- <XDSToken label="XDSHeading" />
- <XDSToken label="XDSText" />
- <XDSToken label="XDSButton" />
- <XDSToken label="XDSCard" />
- <XDSToken label="XDSBadge" />
- <XDSToken label="XDSAvatar" />
- </div>
- </div>
-
- {/* Keywords */}
- <div style={{marginTop: 32}}>
- <XDSHeading level={3}>Keywords</XDSHeading>
- <div
- style={{
- display: 'flex',
- flexWrap: 'wrap' as const,
- gap: 4,
- marginTop: 8,
- }}>
- <XDSToken label="Dashboard" size="sm" />
- <XDSToken label="Admin" size="sm" />
- <XDSToken label="Layout" size="sm" />
- <XDSToken label="Navigation" size="sm" />
- <XDSToken label="Settings" size="sm" />
- </div>
- </div>
- </>
- )}
- </div>
- {/* Inline publish panel — shown when publish is active */}
- <div
- style={{
- display: showPublishModal ? 'flex' : 'none',
- flexDirection: 'column' as const,
- flex: 1,
- }}>
- <InlinePublishPanel
- templateName={templateName}
- isVisible={showPublishModal}
- onBack={() => setShowPublishModal(false)}
- onPublish={onBack}
- />
- </div>
- </div>
- </div>
-
- {/* RIGHT PANEL — preview area */}
- <div
- style={{
- flex: 1,
- minWidth: 0,
- backgroundColor: 'var(--color-background-body, #f5f5f5)',
- display: 'flex',
- flexDirection: 'column' as const,
- opacity: isVisible ? 1 : 0,
- transform: isVisible ? 'none' : 'translateX(40px)',
- transition:
- 'opacity 500ms cubic-bezier(0.16, 1, 0.3, 1), transform 500ms cubic-bezier(0.16, 1, 0.3, 1)',
- }}>
- {/* Editor toolbar */}
- <div style={{backgroundColor: 'var(--color-background-body, #f5f5f5)', borderBottom: 'none'}}>
- {showEditor ? (
- <XDSToolbar
- label="Template actions"
- padding={1}
- dividers={[]}
- startContent={<></>}
- centerContent={
- <XDSSegmentedControl
- value={viewMode}
- onChange={(v: string) =>
- setViewMode(v as 'desktop' | 'mobile')
- }
- label="Viewport size"
- size="sm">
- <XDSTooltip content="Desktop">
- <XDSSegmentedControlItem
- value="desktop"
- label="Desktop"
- isLabelHidden
- icon={<DesktopIcon />}
- />
- </XDSTooltip>
- <XDSTooltip content="Mobile">
- <XDSSegmentedControlItem
- value="mobile"
- label="Mobile"
- isLabelHidden
- icon={<PhoneIcon />}
- />
- </XDSTooltip>
- </XDSSegmentedControl>
- }
- endContent={
- <>
- <XDSTooltip content="Point">
- <XDSButton
- label="Point"
- variant="ghost"
- isIconOnly
- icon={<CursorIcon />}
- />
- </XDSTooltip>
- <XDSTooltip content="Theme">
- <XDSDropdownMenu
- button={{
- label: 'Theme',
- variant: 'ghost',
- isIconOnly: true,
- icon: <PaletteIcon />,
- }}
- hasChevron={false}
- items={XDS_THEMES.map(t => ({
- label: t.label,
- onClick: () => {},
- }))}
- />
- </XDSTooltip>
- <XDSTooltip content="Toggle theme">
- <XDSButton
- label="Toggle theme"
- variant="ghost"
- isIconOnly
- icon={<ContrastIcon />}
- />
- </XDSTooltip>
- <XDSTooltip content="Toggle code">
- <XDSButton
- label="Toggle code"
- variant={editorView === 'code' ? 'secondary' : 'ghost'}
- isIconOnly
- icon={<CodeIcon />}
- onClick={() =>
- setEditorView(
- editorView === 'preview' ? 'code' : 'preview',
- )
- }
- />
- </XDSTooltip>
- <div
- style={{
- width: 1,
- height: 20,
- backgroundColor: 'var(--color-border-strong, #999)',
- margin: '0 4px',
- flexShrink: 0,
- }}
- />
- <XDSTooltip content="Save">
- <XDSButton
- label="Save"
- variant="ghost"
- icon={<SaveIcon />}
- isIconOnly
- onClick={() => {}}
- />
- </XDSTooltip>
- <XDSButton
- label="Publish"
- variant="primary"
- size="sm"
- onClick={() => setShowPublishModal(true)}
- />
- </>
- }
- />
- ) : (
- <div
- style={{
- display: 'flex',
- justifyContent: 'center',
- alignItems: 'center',
- padding: '12px 24px',
- }}>
- <XDSSegmentedControl
- value={viewMode}
- onChange={(v: string) => setViewMode(v as 'desktop' | 'mobile')}
- label="Viewport size"
- size="sm">
- <XDSSegmentedControlItem
- value="desktop"
- label="Desktop"
- isLabelHidden
- icon={<DesktopIcon />}
- />
- <XDSSegmentedControlItem
- value="mobile"
- label="Mobile"
- isLabelHidden
- icon={<PhoneIcon />}
- />
- </XDSSegmentedControl>
- </div>
- )}
- </div>
-
- {/* Preview — browser frame + image */}
- <div
- style={{
- backgroundColor: 'var(--color-background-body, #f5f5f5)',
- padding: '22px 22px 22px',
- display: !showEditor || editorView === 'preview' ? 'flex' : 'none',
- justifyContent: 'center',
- alignItems: 'center',
- flex: 1,
- overflow: 'auto',
- }}>
- <div
- style={{
- width: viewMode === 'mobile' ? 375 : '100%',
- maxWidth: viewMode === 'mobile' ? 375 : 1200,
- aspectRatio: viewMode === 'mobile' ? '9 / 19.5' : '16 / 10',
- backgroundColor: '#fff',
- borderRadius: viewMode === 'mobile' ? 36 : 12,
- border: viewMode === 'mobile' ? '10px solid #fff' : 'none',
- boxShadow:
- viewMode === 'mobile'
- ? '0 8px 40px rgba(0,0,0,0.15), 0 0 0 1px rgba(0,0,0,0.06)'
- : '0 8px 40px rgba(0,0,0,0.12)',
- overflow: 'hidden',
- transition:
- 'width 0.3s ease, aspect-ratio 0.3s ease, border-radius 0.3s ease',
- }}>
- {/* Device chrome */}
- {viewMode === 'desktop' ? (
- <div
- style={{
- display: 'flex',
- alignItems: 'center',
- padding: '10px 14px',
- backgroundColor: '#fff',
- borderBottom: '1px solid #f0f0f0',
- }}>
- <div style={{display: 'flex', gap: 6, alignItems: 'center'}}>
- <div
- style={{
- width: 10,
- height: 10,
- borderRadius: '50%',
- backgroundColor: '#e0e0e0',
- }}
- />
- <div
- style={{
- width: 10,
- height: 10,
- borderRadius: '50%',
- backgroundColor: '#e0e0e0',
- }}
- />
- <div
- style={{
- width: 10,
- height: 10,
- borderRadius: '50%',
- backgroundColor: '#e0e0e0',
- }}
- />
- </div>
- </div>
- ) : null}
- <img
- src={imageSrc}
- alt={templateName}
- style={{
- width: '100%',
- display: 'block',
- }}
- />
- </div>
- </div>
-
- {/* Code block */}
- <div
- style={{
- margin: '0 22px',
- border: '1px solid var(--color-divider, rgba(0,0,0,0.1))',
- borderRadius: 8,
- backgroundColor: 'var(--color-background-muted, rgba(0,0,0,0.03))',
- overflow: 'hidden',
- flex: 1,
- display: showEditor && editorView === 'code' ? 'flex' : 'none',
- flexDirection: 'column' as const,
- minHeight: 0,
- }}>
- <div
- style={{
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'space-between',
- padding: '8px 12px 8px 16px',
- }}>
- <span
- style={{
- fontFamily: '"Roboto Mono", monospace',
- fontSize: 12,
- fontWeight: 500,
- color: 'var(--color-text-secondary, #4e606f)',
- }}>
- typescript — useUser.ts
- </span>
- </div>
- <div style={{display: 'flex', flex: 1, minHeight: 0}}>
- <div
- style={{
- padding: '12px 12px 12px 16px',
- borderRight: '1px solid var(--color-divider, rgba(0,0,0,0.1))',
- fontFamily: '"Roboto Mono", monospace',
- fontSize: 14,
- lineHeight: '20px',
- color: 'var(--color-text-disabled, #a4b0bc)',
- textAlign: 'right',
- userSelect: 'none',
- minWidth: 45,
- }}>
- {codeContent.split('\n').map((_, i) => (
- <div key={i}>{i + 1}</div>
- ))}
- </div>
- <textarea
- value={codeContent}
- onChange={e => setCodeContent(e.target.value)}
- spellCheck={false}
- style={{
- flex: 1,
- padding: '12px 16px',
- fontFamily: '"Roboto Mono", monospace',
- fontSize: 14,
- lineHeight: '20px',
- margin: 0,
- overflow: 'auto',
- color: 'var(--color-text-primary, #0a1317)',
- backgroundColor: 'transparent',
- border: 'none',
- outline: 'none',
- resize: 'none',
- whiteSpace: 'pre',
- tabSize: 2,
- }}
- />
- </div>
- </div>
-
- {/* More like this + Explore more — only visible in preview mode */}
- {(!showEditor || editorView === 'preview') && (
- <>
- <div style={{padding: '16px 32px 0'}}>
- <XDSHeading level={2}>More like this</XDSHeading>
- <div style={{display: 'grid', gridTemplateColumns: 'repeat(5, 1fr)', gap: 12, marginTop: 16}}>
- {TEMPLATES.filter((_, i) => i !== TEMPLATES.findIndex(tt => tt.name === templateName)).slice(0, 10).map((t, i) => (
- <XDSCard
- key={i}
- padding={0}
- onClick={() => {
- const idx = TEMPLATES.indexOf(t);
- onSelectTemplate?.(idx !== -1 ? idx : i);
- }}
- style={{cursor: 'pointer', aspectRatio: '16/10', overflow: 'hidden'}}>
- <img src={t.src} alt={t.name} style={{width: '100%', height: '100%', objectFit: 'cover', objectPosition: 'top', display: 'block'}} />
- </XDSCard>
- ))}
- </div>
- </div>
- <div style={{padding: '32px 32px 40px'}}>
- <XDSHeading level={2}>Explore more</XDSHeading>
- <div style={{display: 'flex', flexWrap: 'wrap' as const, gap: 8, marginTop: 16}}>
- {['website', 'dashboard', 'admin panel', 'settings', 'form layout', 'data table', 'sidebar nav', 'landing page', 'e-commerce', 'documentation', 'profile page'].map(tag => (
- <XDSToken key={tag} label={tag} />
- ))}
- </div>
- </div>
- </>
- )}
- </div>
- </div>
- );
-}
diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplatePreview.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplatePreview.tsx
index 8b69924534..89f5215711 100644
--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplatePreview.tsx
+++ b/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplatePreview.tsx
@@ -18,17 +18,16 @@ import {
PaletteIcon,
ContrastIcon,
SaveIcon,
- ShareIcon,
- ShareOutIcon,
FullscreenIcon,
MoonIcon,
LinkIcon,
CheckIcon,
} from './docsite-icons';
-import {SharePopover} from './SharePopover';
+import {XDSPopover} from '@xds/core/Popover';
+import {SharePopoverContent} from './SharePopover';
-import {VIEWPORT_WIDTHS, XDS_THEMES} from './constants';
-import {BoidsCanvas, type BoidsSimulation} from './BoidsCanvas';
+import {XDS_THEMES} from './constants';
+import {CraftingCat} from './CraftingCat';
import type {PointedElement} from './ChatPanel';
@@ -37,7 +36,6 @@ export function TemplatePreview({
imageSrc,
onBack: _onBack,
isGenerating,
- simulation,
onPublish,
isPointing,
onPointingChange,
@@ -53,7 +51,6 @@ export function TemplatePreview({
imageSrc: string;
onBack: () => void;
isGenerating: boolean;
- simulation: BoidsSimulation;
onPublish?: () => void;
isPointing?: boolean;
onPointingChange?: (pointing: boolean) => void;
@@ -68,10 +65,12 @@ export function TemplatePreview({
const [internalViewportSize, setViewportSize] = useState('desktop');
const viewportSize = externalViewportSize ?? internalViewportSize;
const previewRef = useRef(null);
- const [previewSize, setPreviewSize] = useState({w: 0, h: 0});
+
const [showCanvas, setShowCanvas] = useState(false);
const [isDarkMode, setIsDarkMode] = useState(false);
- const [saveState, setSaveState] = useState<'idle' | 'saving' | 'saved'>('idle');
+ const [saveState, setSaveState] = useState<'idle' | 'saving' | 'saved'>(
+ 'idle',
+ );
const [linkCopied, setLinkCopied] = useState(false);
const [isScrolled, setIsScrolled] = useState(false);
@@ -87,23 +86,8 @@ export function TemplatePreview({
}, []);
const scrollRef = useRef<HTMLDivElement>(null);
const [showSharePopover, setShowSharePopover] = useState(false);
- const [sharePopoverPos, setSharePopoverPos] = useState(null as {top: number; left: number} | null);
- const shareButtonRef = useRef(null);
-
const shareCliCommand = `npx xds template ${templateName.toLowerCase().replace(/\s+/g, '-')} ./my-project`;
- useEffect(() => {
- if (!showSharePopover) return;
- const handleClickOutside = (e: MouseEvent) => {
- const popover = document.querySelector('[data-share-popover]');
- if (popover && !popover.contains(e.target as Node)) {
- setShowSharePopover(false);
- }
- };
- document.addEventListener('mousedown', handleClickOutside);
- return () => document.removeEventListener('mousedown', handleClickOutside);
- }, [showSharePopover]);
-
useEffect(() => {
const el = scrollRef.current;
if (!el) return;
@@ -113,9 +97,7 @@ export function TemplatePreview({
}, []);
useEffect(() => {
- if (isGenerating && previewRef.current) {
- const rect = (previewRef.current as HTMLElement).getBoundingClientRect();
- setPreviewSize({w: rect.width, h: rect.height});
+ if (isGenerating) {
setShowCanvas(true);
}
}, [isGenerating]);
@@ -138,20 +120,24 @@ export function TemplatePreview({
position: 'relative' as const,
}}>
{/* Toolbar — outside overflow:hidden so dropdowns aren't clipped */}
- {!hideToolbar && <div
+ {!hideToolbar && (
+ <div
+ style={{
+ background: 'none',
+ position: 'absolute',
+ top: 0,
+ left: 0,
+ right: 0,
+ zIndex: 10,
+ paddingTop: 8,
+ display: 'flex',
+ justifyContent: 'center',
+ }}>
+ <div
style={{
- background: 'none',
- position: 'absolute',
- top: 0,
- left: 0,
- right: 0,
- zIndex: 10,
- paddingTop: 8,
- display: 'flex',
- justifyContent: 'center',
- }}>
- <div style={{
- backgroundColor: isScrolled ? 'var(--color-background-card, #fff)' : (previewBackground ?? 'var(--color-background-card, #fff)'),
+ backgroundColor: isScrolled
+ ? 'var(--color-background-card, #fff)'
+ : (previewBackground ?? 'var(--color-background-card, #fff)'),
borderRadius: 'var(--radius-container, 12px)',
border: 'none',
display: 'inline-flex',
@@ -164,170 +150,164 @@ export function TemplatePreview({
padding={0}
centerContent={
isPublishing ? (
- <>
- <XDSSegmentedControl
- value={viewportSize}
- onChange={setViewportSize}
- label="Viewport size"
- size="sm">
- <XDSTooltip content="Desktop">
- <XDSSegmentedControlItem
- value="desktop"
- label="Desktop"
- isLabelHidden
- icon={<DesktopIcon />}
- />
- </XDSTooltip>
- <XDSTooltip content="Phone">
- <XDSSegmentedControlItem
- value="phone"
- label="Phone"
- isLabelHidden
- icon={<PhoneIcon />}
- />
- </XDSTooltip>
- </XDSSegmentedControl>
- </>
+ <>
+ <XDSSegmentedControl
+ value={viewportSize}
+ onChange={setViewportSize}
+ label="Viewport size"
+ size="sm">
+ <XDSTooltip content="Desktop">
+ <XDSSegmentedControlItem
+ value="desktop"
+ label="Desktop"
+ isLabelHidden
+ icon={<DesktopIcon />}
+ />
+ </XDSTooltip>
+ <XDSTooltip content="Phone">
+ <XDSSegmentedControlItem
+ value="phone"
+ label="Phone"
+ isLabelHidden
+ icon={<PhoneIcon />}
+ />
+ </XDSTooltip>
+ </XDSSegmentedControl>
+ </>
) : (
- <>
- <XDSTooltip content="Point">
- <XDSButton
- label="Point"
- variant={isPointing ? 'secondary' : 'ghost'}
- isIconOnly
- icon={<CursorIcon />}
- onClick={() => onPointingChange?.(!isPointing)}
- />
- </XDSTooltip>
- <XDSTooltip content="Theme">
- <XDSDropdownMenu
- button={{
- label: 'Theme',
- variant: 'ghost',
- isIconOnly: true,
- icon: <PaletteIcon />,
- }}
- hasChevron={false}
- items={XDS_THEMES.map(t => ({
- label: t.label,
- onClick: () => {},
- }))}
- />
- </XDSTooltip>
- <XDSTooltip content={isDarkMode ? "Dark mode" : "Light mode"}>
- <XDSButton
- label={isDarkMode ? "Dark mode" : "Light mode"}
- variant="ghost"
- isIconOnly
- icon={isDarkMode ? <MoonIcon /> : <ContrastIcon />}
- onClick={() => setIsDarkMode(prev => !prev)}
- />
- </XDSTooltip>
- <XDSSegmentedControl
- value={viewportSize}
- onChange={setViewportSize}
- label="Viewport size"
- size="sm">
- <XDSTooltip content="Desktop">
- <XDSSegmentedControlItem
- value="desktop"
- label="Desktop"
- isLabelHidden
- icon={<DesktopIcon />}
+ <>
+ <XDSTooltip content="Point">
+ <XDSButton
+ label="Point"
+ variant={isPointing ? 'secondary' : 'ghost'}
+ isIconOnly
+ icon={<CursorIcon />}
+ onClick={() => onPointingChange?.(!isPointing)}
/>
</XDSTooltip>
- <XDSTooltip content="Phone">
- <XDSSegmentedControlItem
- value="phone"
- label="Phone"
- isLabelHidden
- icon={<PhoneIcon />}
+ <XDSTooltip content="Theme">
+ <XDSDropdownMenu
+ button={{
+ label: 'Theme',
+ variant: 'ghost',
+ isIconOnly: true,
+ icon: <PaletteIcon />,
+ }}
+ hasChevron={false}
+ items={XDS_THEMES.map(t => ({
+ label: t.label,
+ onClick: () => {},
+ }))}
/>
</XDSTooltip>
- </XDSSegmentedControl>
- <XDSTooltip content="Preview">
- <XDSButton
- label="Preview"
- variant="ghost"
- isIconOnly
- icon={<FullscreenIcon />}
- onClick={() => onFullPreviewChange?.(true)}
- />
- </XDSTooltip>
- {saveState === 'saved' ? (
- <XDSTooltip content={linkCopied ? "Copied!" : "Copy link"}>
+ <XDSTooltip
+ content={isDarkMode ? 'Dark mode' : 'Light mode'}>
<XDSButton
- label={linkCopied ? "Copied" : "Copy link"}
+ label={isDarkMode ? 'Dark mode' : 'Light mode'}
variant="ghost"
- icon={linkCopied ? <CheckIcon color="var(--color-icon-primary, #111)" /> : <LinkIcon />}
isIconOnly
- onClick={handleCopyLink}
+ icon={isDarkMode ? <MoonIcon /> : <ContrastIcon />}
+ onClick={() => setIsDarkMode(prev => !prev)}
/>
</XDSTooltip>
- ) : saveState === 'saving' ? (
- <div style={{display: 'flex', alignItems: 'center', justifyContent: 'center', width: 32, height: 32}}>
- <XDSSpinner size="sm" />
- </div>
- ) : (
- <XDSTooltip content="Save">
+ <XDSSegmentedControl
+ value={viewportSize}
+ onChange={setViewportSize}
+ label="Viewport size"
+ size="sm">
+ <XDSTooltip content="Desktop">
+ <XDSSegmentedControlItem
+ value="desktop"
+ label="Desktop"
+ isLabelHidden
+ icon={<DesktopIcon />}
+ />
+ </XDSTooltip>
+ <XDSTooltip content="Phone">
+ <XDSSegmentedControlItem
+ value="phone"
+ label="Phone"
+ isLabelHidden
+ icon={<PhoneIcon />}
+ />
+ </XDSTooltip>
+ </XDSSegmentedControl>
+ <XDSTooltip content="Preview">
<XDSButton
- label="Save"
+ label="Preview"
variant="ghost"
- icon={<SaveIcon />}
isIconOnly
- onClick={handleSave}
+ icon={<FullscreenIcon />}
+ onClick={() => onFullPreviewChange?.(true)}
/>
</XDSTooltip>
- )}
- <XDSButton
- label="Submit"
- variant="secondary"
- size="sm"
- onClick={() => onPublish?.()}
- />
- <div
- style={{position: 'relative'}}>
+ {saveState === 'saved' ? (
+ <XDSTooltip
+ content={linkCopied ? 'Copied!' : 'Copy link'}>
+ <XDSButton
+ label={linkCopied ? 'Copied' : 'Copy link'}
+ variant="ghost"
+ icon={
+ linkCopied ? (
+ <CheckIcon color="var(--color-icon-primary, #111)" />
+ ) : (
+ <LinkIcon />
+ )
+ }
+ isIconOnly
+ onClick={handleCopyLink}
+ />
+ </XDSTooltip>
+ ) : saveState === 'saving' ? (
+ <div
+ style={{
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ width: 32,
+ height: 32,
+ }}>
+ <XDSSpinner size="sm" />
+ </div>
+ ) : (
+ <XDSTooltip content="Save">
+ <XDSButton
+ label="Save"
+ variant="ghost"
+ icon={<SaveIcon />}
+ isIconOnly
+ onClick={handleSave}
+ />
+ </XDSTooltip>
+ )}
<XDSButton
- label="Use"
- variant="primary"
+ label="Submit"
+ variant="secondary"
size="sm"
- ref={shareButtonRef}
- onClick={() => {
- setShowSharePopover(prev => {
- if (!prev && shareButtonRef.current) {
- const rect =
- (shareButtonRef.current as HTMLElement).getBoundingClientRect();
- const popoverWidth = 340;
- const popoverHeight = 400;
- const left = Math.min(
- Math.max(8, rect.right - popoverWidth),
- window.innerWidth - popoverWidth - 16,
- );
- const top =
- rect.bottom + 4 + popoverHeight + 16 >
- window.innerHeight
- ? rect.top - popoverHeight - 4
- : rect.bottom + 4;
- setSharePopoverPos({top, left});
- }
- return !prev;
- });
- }}
+ onClick={() => onPublish?.()}
/>
- {showSharePopover && sharePopoverPos && (
- <SharePopover
- cliCommand={shareCliCommand}
- position={sharePopoverPos}
- onClose={() => setShowSharePopover(false)}
- />
- )}
- </div>
- </>
+ <XDSPopover
+ label="Add to project"
+ isOpen={showSharePopover}
+ onOpenChange={setShowSharePopover}
+ placement="below"
+ alignment="end"
+ width={340}
+ content={
+ <SharePopoverContent
+ cliCommand={shareCliCommand}
+ onClose={() => setShowSharePopover(false)}
+ />
+ }>
+ <XDSButton label="Use" variant="primary" size="sm" />
+ </XDSPopover>
+ </>
)
}
/>
- </div>
- </div>}
+ </div>
+ </div>
+ )}
{/* Bordered container: preview/code/publish */}
<div
@@ -340,92 +320,125 @@ export function TemplatePreview({
minHeight: 0,
position: 'relative' as const,
}}>
- {/* Exit preview button — shown in full preview mode */}
- {isFullPreview && (
- <div style={{
+ {/* Exit preview button — shown in full preview mode */}
+ {isFullPreview && (
+ <div
+ style={{
position: 'absolute',
top: 16,
right: 16,
zIndex: 20,
}}>
- <XDSButton
- label="Exit preview"
- variant="secondary"
- size="sm"
- onClick={() => onFullPreviewChange?.(false)}
- />
- </div>
- )}
+ <XDSButton
+ label="Exit preview"
+ variant="secondary"
+ size="sm"
+ onClick={() => onFullPreviewChange?.(false)}
+ />
+ </div>
+ )}
- {/* Preview — full-bleed image */}
+ {/* Preview — full-bleed image */}
+ <div
+ ref={el => {
+ (
+ previewRef as React.MutableRefObject<HTMLDivElement | null>
+ ).current = el;
+ (
+ scrollRef as React.MutableRefObject<HTMLDivElement | null>
+ ).current = el;
+ }}
+ style={{
+ position: 'relative',
+ flex: 1,
+ overflow: 'auto',
+ display: 'flex',
+ justifyContent: 'center',
+ alignItems: 'flex-start',
+ backgroundColor:
+ previewBackground ?? 'var(--color-background-surface, #fff)',
+ padding: isFullPreview
+ ? 0
+ : viewportSize === 'phone'
+ ? 24
+ : previewBackground
+ ? '64px 16px 16px 16px'
+ : '64px 16px 16px 0',
+ cursor: isPointing ? 'crosshair' : undefined,
+ transition: 'background-color 300ms ease, padding 300ms ease',
+ }}
+ onClick={
+ isPointing
+ ? (e: React.MouseEvent) => {
+ const target = e.target as HTMLElement;
+ const rect = target.getBoundingClientRect();
+ onElementPointed?.({
+ tagName: target.tagName,
+ componentName: target.dataset.component,
+ rect: {
+ x: rect.x,
+ y: rect.y,
+ width: rect.width,
+ height: rect.height,
+ },
+ });
+ onPointingChange?.(false);
+ }
+ : undefined
+ }>
<div
- ref={(el) => {
- (previewRef as React.MutableRefObject<HTMLDivElement | null>).current = el;
- (scrollRef as React.MutableRefObject<HTMLDivElement | null>).current = el;
- }}
style={{
position: 'relative',
- flex: 1,
- overflow: 'auto',
- display: 'flex',
- justifyContent: 'center',
- alignItems: 'flex-start',
- backgroundColor: previewBackground ?? 'var(--color-background-surface, #fff)',
- padding: isFullPreview ? 0 : (viewportSize === 'phone' ? 24 : (previewBackground ? '64px 16px 16px 16px' : '64px 16px 16px 0')),
- cursor: isPointing ? 'crosshair' : undefined,
- transition: 'background-color 300ms ease, padding 300ms ease',
- }}
- onClick={isPointing ? (e: React.MouseEvent) => {
- const target = e.target as HTMLElement;
- const rect = target.getBoundingClientRect();
- onElementPointed?.({
- tagName: target.tagName,
- componentName: target.dataset.component,
- rect: {x: rect.x, y: rect.y, width: rect.width, height: rect.height},
- });
- onPointingChange?.(false);
- } : undefined}>
- <div style={{
width: viewportSize === 'phone' ? 375 : '100%',
- borderRadius: viewportSize === 'phone' ? 36 : (isFullPreview ? 0 : 'var(--radius-container, 12px)'),
- border: previewBackground ? 'none' : (isFullPreview ? 'none' : '1px solid var(--color-divider, #e0e0e0)'),
- boxShadow: previewBackground && !isFullPreview ? 'rgba(0, 0, 0, 0.08) 0px 1px 3px, rgba(0, 0, 0, 0.06) 0px 4px 12px' : 'none',
+ borderRadius:
+ viewportSize === 'phone'
+ ? 36
+ : isFullPreview
+ ? 0
+ : 'var(--radius-container, 12px)',
+ border: previewBackground
+ ? 'none'
+ : isFullPreview
+ ? 'none'
+ : '1px solid var(--color-divider, #e0e0e0)',
+ boxShadow:
+ previewBackground && !isFullPreview
+ ? 'rgba(0, 0, 0, 0.08) 0px 1px 3px, rgba(0, 0, 0, 0.06) 0px 4px 12px'
+ : 'none',
overflow: 'hidden',
flexShrink: 0,
margin: isFullPreview ? 0 : 'auto 0',
transition: 'width 300ms ease, border-radius 300ms ease',
}}>
- <img
- src={imageSrc}
- alt="Template preview"
- style={{
- display: 'block',
- width: '100%',
- aspectRatio: viewportSize === 'phone' ? '9 / 19.5' : undefined,
- objectFit: viewportSize === 'phone' ? 'cover' : undefined,
- opacity: isGenerating ? 0 : 1,
- transition: 'opacity 600ms ease',
- }}
- />
- </div>
+ <img
+ src={imageSrc}
+ alt="Template preview"
+ style={{
+ display: 'block',
+ width: '100%',
+ aspectRatio: viewportSize === 'phone' ? '9 / 19.5' : undefined,
+ objectFit: viewportSize === 'phone' ? 'cover' : undefined,
+ opacity: isGenerating ? 0 : 1,
+ transition: 'opacity 600ms ease',
+ }}
+ />
{showCanvas && (
<div
style={{
position: 'absolute',
inset: 0,
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
opacity: isGenerating ? 1 : 0,
transition: 'opacity 600ms ease',
}}>
- <BoidsCanvas
- width={previewSize.w}
- height={previewSize.h}
- simulation={simulation}
- />
+ <CraftingCat />
</div>
)}
</div>
-
</div>
</div>
+ </div>
);
}
diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/page.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/page.tsx
index 2506af75b1..55636e4b49 100644
--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/page.tsx
+++ b/apps/sandbox/src/app/(fullscreen)/pages/docsite/page.tsx
@@ -1,51 +1,52 @@
'use client';
import * as stylex from '@stylexjs/stylex';
-import React, {Suspense, useState, useEffect, useRef, useCallback, useMemo} from 'react';
+import React, {
+ Suspense,
+ useState,
+ useEffect,
+ useRef,
+ useCallback,
+ useMemo,
+} from 'react';
import {useSearchParams, useRouter} from 'next/navigation';
-import {createSimulation} from './BoidsCanvas';
-import type {BoidsSimulation} from './BoidsCanvas';
-import {TEMPLATES, XDS_THEMES, AVATAR_IMAGE, THEME_PICKER_ENTRIES, basePath} from './constants';
+import {
+ TEMPLATES,
+ AVATAR_IMAGE,
+ THEME_PICKER_ENTRIES,
+ basePath,
+} from './constants';
import {TemplateCard} from './TemplateCard';
import {AIComposer} from './AIComposer';
import {ChatPanel} from './ChatPanel';
import type {PanelTab, PointedElement} from './ChatPanel';
import {InlinePublishPanel} from './InlinePublishPanel';
import {TemplatePreview} from './TemplatePreview';
-import {SharePopover} from './SharePopover';
+import {SharePopoverContent} from './SharePopover';
import {AppTopNav} from './AppTopNav';
import {DocsView} from './DocsView';
import {ProfileView} from './ProfileView';
+import {XDSAppShell} from '@xds/core/AppShell';
import {XDSAvatar} from '@xds/core/Avatar';
+import {XDSStack} from '@xds/core/Layout';
import {XDSButton} from '@xds/core/Button';
import {XDSCard} from '@xds/core/Card';
+import {XDSDialog} from '@xds/core/Dialog';
+import {XDSDivider} from '@xds/core/Divider';
import {XDSHeading, XDSText} from '@xds/core/Text';
+import {XDSTabList, XDSTab} from '@xds/core/TabList';
import {XDSToken} from '@xds/core/Token';
-import {XDSDropdownMenu} from '@xds/core/DropdownMenu';
-import {
- XDSSegmentedControl,
- XDSSegmentedControlItem,
-} from '@xds/core/SegmentedControl';
import {XDSPopover} from '@xds/core/Popover';
import {XDSTextInput} from '@xds/core/TextInput';
-import {XDSToolbar} from '@xds/core/Toolbar';
import {XDSTooltip} from '@xds/core/Tooltip';
import {
ArrowLeftIcon,
- DesktopIcon,
- PhoneIcon,
- CursorIcon,
- PaletteIcon,
- ContrastIcon,
- SaveIcon,
- ShareIcon,
BookmarkIcon,
BookmarkFilledIcon,
StarIcon,
StarFilledIcon,
SearchIcon,
- LinkIcon,
MetaLogo,
WhatsAppLogo,
ThreadsLogo,
@@ -56,7 +57,10 @@ import {
MidnightThemeIcon,
} from './docsite-icons';
-const BRAND_LOGOS: Record<string, React.ComponentType<React.SVGProps<SVGSVGElement>>> = {
+const BRAND_LOGOS: Record<
+ string,
+ React.ComponentType<React.SVGProps<SVGSVGElement>>
+> = {
default: DefaultThemeIcon,
meta: MetaLogo,
whatsapp: WhatsAppLogo,
@@ -108,16 +112,22 @@ function DocsiteLandingTemplate() {
const v = searchParams.get('view');
const t = searchParams.get('template');
const templateIdx = t !== null ? parseInt(t, 10) : null;
- return {view: v, templateIdx: isNaN(templateIdx as number) ? null : templateIdx};
+ return {
+ view: v,
+ templateIdx: isNaN(templateIdx as number) ? null : templateIdx,
+ };
}, [searchParams]);
const [activeView, setActiveView] = useState(
'craft' as 'craft' | 'explore' | 'docs' | 'profile',
);
const [selected, setSelected] = useState(new Set());
+ const [activeTab, setActiveTab] = useState('all');
const [isMobile, setIsMobile] = useState(false);
- const [isTablet, setIsTablet] = useState(false);
- const [generatingSource, setGeneratingSource] = useState(null as number | null);
+ const [_isTablet, setIsTablet] = useState(false);
+ const [generatingSource, setGeneratingSource] = useState(
+ null as number | null,
+ );
const [chatOpen, setChatOpen] = useState(false);
const [previewTarget, setPreviewTarget] = useState(
initialView.view === 'preview' ? initialView.templateIdx : null,
@@ -132,23 +142,21 @@ function DocsiteLandingTemplate() {
const [pointedElement, setPointedElement] = useState<PointedElement>(null);
const [editorPanelWidth, setEditorPanelWidth] = useState(380);
const [isEditorResizing, setIsEditorResizing] = useState(false);
- const [editorViewport, setEditorViewport] = useState('desktop');
+ const [_editorViewport, _setEditorViewport] = useState('desktop');
const [fullPreview, setFullPreview] = useState(false);
- const [showSharePopover, setShowSharePopover] = useState(false);
- const [sharePopoverPos, setSharePopoverPos] = useState(null as {top: number; left: number} | null);
- const shareButtonRef = useRef<HTMLButtonElement>(null);
+
const scrollContainerRef = useRef(null);
const [card4SelectedOption, setCard4SelectedOption] = useState('default');
const [card4ThemeBrowse, setCard4ThemeBrowse] = useState(false);
const [card4Bookmarked, setCard4Bookmarked] = useState(false);
- const card4ScrollRef = useRef<HTMLDivElement>(null);
- const card4AddButtonRef = useRef<HTMLButtonElement>(null);
- const card4AddPopoverRef = useRef<HTMLDivElement>(null);
const [card4ShowAddPopover, setCard4ShowAddPopover] = useState(false);
- const [card4AddPopoverPos, setCard4AddPopoverPos] = useState(null as {top: number; left: number} | null);
+ const card4ScrollRef = useRef<HTMLDivElement>(null);
const [card4ThemeSearch, setCard4ThemeSearch] = useState('');
const [card4PinnedThemes, setCard4PinnedThemes] = useState(
- () => new Set(THEME_PICKER_ENTRIES.filter(t => t.isPinnedByDefault).map(t => t.key)),
+ () =>
+ new Set(
+ THEME_PICKER_ENTRIES.filter(t => t.isPinnedByDefault).map(t => t.key),
+ ),
);
const toggleCard4Pin = useCallback((key: string) => {
setCard4PinnedThemes(prev => {
@@ -159,42 +167,36 @@ function DocsiteLandingTemplate() {
});
}, []);
- const handleEditorResizeStart = useCallback((e: React.MouseEvent) => {
- e.preventDefault();
- setIsEditorResizing(true);
- const startX = e.clientX;
- const startWidth = editorPanelWidth;
+ const handleEditorResizeStart = useCallback(
+ (e: React.MouseEvent) => {
+ e.preventDefault();
+ setIsEditorResizing(true);
+ const startX = e.clientX;
+ const startWidth = editorPanelWidth;
- const onMouseMove = (ev: MouseEvent) => {
- const maxWidth = Math.floor(window.innerWidth / 2);
- const newWidth = Math.min(Math.max(startWidth + (ev.clientX - startX), 280), maxWidth);
- setEditorPanelWidth(newWidth);
- };
- const onMouseUp = () => {
- setIsEditorResizing(false);
- document.removeEventListener('mousemove', onMouseMove);
- document.removeEventListener('mouseup', onMouseUp);
- document.body.style.cursor = '';
- document.body.style.userSelect = '';
- };
-
- document.body.style.cursor = 'col-resize';
- document.body.style.userSelect = 'none';
- document.addEventListener('mousemove', onMouseMove);
- document.addEventListener('mouseup', onMouseUp);
- }, [editorPanelWidth]);
+ const onMouseMove = (ev: MouseEvent) => {
+ const maxWidth = Math.floor(window.innerWidth / 2);
+ const newWidth = Math.min(
+ Math.max(startWidth + (ev.clientX - startX), 280),
+ maxWidth,
+ );
+ setEditorPanelWidth(newWidth);
+ };
+ const onMouseUp = () => {
+ setIsEditorResizing(false);
+ document.removeEventListener('mousemove', onMouseMove);
+ document.removeEventListener('mouseup', onMouseUp);
+ document.body.style.cursor = '';
+ document.body.style.userSelect = '';
+ };
- useEffect(() => {
- if (!showSharePopover) return;
- const handleClickOutside = (e: MouseEvent) => {
- const popover = document.querySelector('[data-share-popover]');
- if (popover && !popover.contains(e.target as Node)) {
- setShowSharePopover(false);
- }
- };
- document.addEventListener('mousedown', handleClickOutside);
- return () => document.removeEventListener('mousedown', handleClickOutside);
- }, [showSharePopover]);
+ document.body.style.cursor = 'col-resize';
+ document.body.style.userSelect = 'none';
+ document.addEventListener('mousemove', onMouseMove);
+ document.addEventListener('mouseup', onMouseUp);
+ },
+ [editorPanelWidth],
+ );
// Sync URL when view state changes
useEffect(() => {
@@ -215,28 +217,6 @@ function DocsiteLandingTemplate() {
}, [activeView]);
const timerRef = useRef(null as ReturnType<typeof setTimeout> | null);
const previewTimerRef = useRef(null as ReturnType<typeof setTimeout> | null);
- const simRef = useRef(null as BoidsSimulation | null);
- const simAnimRef = useRef(0 as number);
-
- if (!simRef.current) {
- simRef.current = createSimulation();
- }
-
- // Single update loop for the shared simulation
- const simRunning = generatingSource !== null || previewGenerating;
- useEffect(() => {
- if (!simRunning) {
- cancelAnimationFrame(simAnimRef.current);
- return;
- }
- function tick() {
- simRef.current!.update();
- simAnimRef.current = requestAnimationFrame(tick);
- }
- simAnimRef.current = requestAnimationFrame(tick);
- return () => cancelAnimationFrame(simAnimRef.current);
- }, [simRunning]);
-
useEffect(() => {
const mobileMql = window.matchMedia('(max-width: 768px)');
const tabletMql = window.matchMedia(
@@ -314,7 +294,10 @@ function DocsiteLandingTemplate() {
display: 'flex',
height: '100vh',
overflow: 'hidden',
- backgroundColor: useTarget !== 3 ? 'var(--color-background-body)' : 'var(--color-background-surface, #fff)',
+ backgroundColor:
+ useTarget !== 3
+ ? 'var(--color-background-body)'
+ : 'var(--color-background-surface, #fff)',
}}>
<style>
{'@keyframes slideInLeft { from { opacity: 0; transform: translateX(-40px); } to { opacity: 1; transform: translateX(0); } }' +
@@ -323,137 +306,133 @@ function DocsiteLandingTemplate() {
'.xds-editor-resize-grip:hover .xds-editor-resize-handle { opacity: 0.6; }' +
'.xds-editor-resize-grip[data-resizing="true"] .xds-editor-resize-handle { opacity: 1; }'}
</style>
- {!fullPreview && <div
- style={{
- width: editorPanelWidth,
- minWidth: 280,
- maxWidth: '50vw',
- flexShrink: 0,
- padding: 16,
- paddingRight: 0,
- display: 'flex',
- animation: 'slideInLeft 500ms cubic-bezier(0.16, 1, 0.3, 1)',
- }}>
+ {!fullPreview && (
<div
style={{
- flex: 1,
- backgroundColor: 'var(--color-background-card, #fff)',
- borderRadius: 16,
- border: useTarget !== 3 ? 'none' : '1px solid var(--color-divider, #e0e0e0)',
- overflow: 'hidden',
+ width: editorPanelWidth,
+ minWidth: 280,
+ maxWidth: '50vw',
+ flexShrink: 0,
+ padding: 16,
+ paddingRight: 0,
display: 'flex',
- flexDirection: 'column' as const,
+ animation: 'slideInLeft 500ms cubic-bezier(0.16, 1, 0.3, 1)',
}}>
- {/* Persistent tab bar — hidden when publishing */}
- {!showPublishCard1 && (
<div
style={{
+ flex: 1,
+ backgroundColor: 'var(--color-background-card, #fff)',
+ borderRadius: 16,
+ border:
+ useTarget !== 3
+ ? 'none'
+ : '1px solid var(--color-divider, #e0e0e0)',
+ overflow: 'hidden',
display: 'flex',
- alignItems: 'center',
- padding: '0 8px 0 16px',
- borderBottom: '1px solid var(--color-divider, #e0e0e0)',
- flexShrink: 0,
+ flexDirection: 'column' as const,
}}>
- <XDSButton
- label="Back"
- variant="ghost"
- size="sm"
- icon={<ArrowLeftIcon />}
- isIconOnly
- onClick={handleBackFromUse}
- style={{flexShrink: 0, marginRight: 4}}
- />
- {(['configure', 'properties', 'code'] as const).map(tab => (
- <button
- key={tab}
- onClick={() => setPanelTab(tab)}
- style={{
- flex: 1,
- padding: '10px 0',
- background: 'none',
- border: 'none',
- borderBottom:
- panelTab === tab
- ? '2px solid var(--color-text-primary, #111)'
- : '2px solid transparent',
- marginBottom: -1,
- cursor: 'pointer',
- textAlign: 'center' as const,
- transition: 'border-color 150ms ease',
- }}>
- <XDSText
- type="body"
- color={panelTab === tab ? 'primary' : 'secondary'}>
- {tab === 'configure'
- ? 'Craft'
- : tab === 'properties'
- ? 'Properties'
- : 'Code'}
- </XDSText>
- </button>
- ))}
+ {/* Persistent tab bar — hidden when publishing */}
+ {!showPublishCard1 && (
+ <XDSStack direction="vertical" gap={0} style={{flexShrink: 0}}>
+ <XDSStack
+ direction="horizontal"
+ gap={0}
+ vAlign="center"
+ style={{paddingLeft: 8, paddingTop: 8, paddingRight: 8}}>
+ <XDSButton
+ label="Back"
+ variant="ghost"
+ size="sm"
+ icon={<ArrowLeftIcon />}
+ isIconOnly
+ onClick={handleBackFromUse}
+ />
+ <XDSTabList
+ value={panelTab}
+ onChange={v =>
+ setPanelTab(v as 'configure' | 'properties' | 'code')
+ }
+ size="md"
+ layout="fill">
+ <XDSTab value="configure" label="Craft" />
+ <XDSTab value="code" label="Code" />
+ <XDSTab value="properties" label="Properties" />
+ </XDSTabList>
+ </XDSStack>
+ <XDSDivider />
+ </XDSStack>
+ )}
+ {showPublishCard1 ? (
+ <InlinePublishPanel
+ templateName={t.name}
+ isVisible={showPublishCard1}
+ onBack={() => setShowPublishCard1(false)}
+ onPublish={handleBackFromUse}
+ />
+ ) : (
+ <ChatPanel
+ isGenerating={previewGenerating}
+ onSend={handlePreviewSend}
+ activeView={activeView}
+ setActiveView={setActiveView}
+ templateName={t.name}
+ onBack={handleBackFromUse}
+ activeTab={panelTab}
+ onTabChange={setPanelTab}
+ pointedElement={pointedElement}
+ hideHeader
+ />
+ )}
</div>
- )}
- {showPublishCard1 ? (
- <InlinePublishPanel
- templateName={t.name}
- isVisible={showPublishCard1}
- onBack={() => setShowPublishCard1(false)}
- onPublish={handleBackFromUse}
- />
- ) : (
- <ChatPanel
- isGenerating={previewGenerating}
- onSend={handlePreviewSend}
- activeView={activeView}
- setActiveView={setActiveView}
- templateName={t.name}
- onBack={handleBackFromUse}
- activeTab={panelTab}
- onTabChange={setPanelTab}
- pointedElement={pointedElement}
- hideHeader
- />
- )}
</div>
- </div>}
+ )}
{/* Resize handle */}
- {!fullPreview && <div
- onMouseDown={handleEditorResizeStart}
- data-resizing={isEditorResizing}
- className="xds-editor-resize-grip"
- style={{
- width: 16,
- flexShrink: 0,
- cursor: 'col-resize',
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- zIndex: 10,
- backgroundColor: 'transparent',
- marginRight: useTarget !== 3 ? -16 : 0,
- }}>
+ {!fullPreview && (
<div
- className="xds-editor-resize-handle"
+ onMouseDown={handleEditorResizeStart}
+ data-resizing={isEditorResizing}
+ className="xds-editor-resize-grip"
style={{
- width: 3,
- height: 32,
- borderRadius: 2,
- backgroundColor: isEditorResizing
- ? 'var(--color-icon-primary, #111)'
- : 'var(--color-border-strong, #ccc)',
- }}
- />
- </div>}
+ width: 16,
+ flexShrink: 0,
+ cursor: 'col-resize',
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ zIndex: 10,
+ backgroundColor: 'transparent',
+ marginRight: useTarget !== 3 ? -16 : 0,
+ }}>
+ <div
+ className="xds-editor-resize-handle"
+ style={{
+ width: 3,
+ height: 32,
+ borderRadius: 2,
+ backgroundColor: isEditorResizing
+ ? 'var(--color-icon-primary, #111)'
+ : 'var(--color-border-strong, #ccc)',
+ }}
+ />
+ </div>
+ )}
<div
- style={{flex: 1, display: 'flex', flexDirection: 'column' as const, minWidth: 0, overflow: 'visible'}}>
+ style={{
+ flex: 1,
+ display: 'flex',
+ flexDirection: 'column' as const,
+ minWidth: 0,
+ overflow: 'visible',
+ }}>
<TemplatePreview
templateName={t.name}
imageSrc={t.src}
onBack={handleBackFromUse}
isGenerating={previewGenerating}
- simulation={simRef.current!}
- onPublish={() => { setShowPublishCard1(true); setEditorPanelWidth(380); }}
+ onPublish={() => {
+ setShowPublishCard1(true);
+ setEditorPanelWidth(380);
+ }}
isPointing={isPointing}
onPointingChange={setIsPointing}
onElementPointed={el => {
@@ -464,7 +443,9 @@ function DocsiteLandingTemplate() {
isFullPreview={fullPreview}
onFullPreviewChange={setFullPreview}
hideToolbar={fullPreview}
- previewBackground={useTarget !== 3 ? 'var(--color-background-body)' : undefined}
+ previewBackground={
+ useTarget !== 3 ? 'var(--color-background-body)' : undefined
+ }
/>
</div>
</div>
@@ -484,18 +465,18 @@ function DocsiteLandingTemplate() {
}
return (
- <div
- style={{
- display: 'flex',
- flexDirection: 'column' as const,
- height: '100vh',
- backgroundColor: 'var(--color-background-surface, white)',
- }}>
- <AppTopNav
- activeView={activeView}
- setActiveView={setActiveView}
- scrollContainerRef={scrollContainerRef}
- />
+ <XDSAppShell
+ variant="surface"
+ height="fill"
+ topNav={
+ <AppTopNav
+ activeView={activeView}
+ setActiveView={setActiveView}
+ scrollContainerRef={scrollContainerRef}
+ activeTab={activeTab}
+ onActiveTabChange={setActiveTab}
+ />
+ }>
<div
style={{
display: 'flex',
@@ -532,24 +513,47 @@ function DocsiteLandingTemplate() {
flexDirection: 'column' as const,
}}>
<div style={{display: 'flex', flex: 1, overflow: 'hidden'}}>
- {/* Masonry Grid */}
<div
ref={scrollContainerRef}
style={{
flex: 1,
overflow: 'auto',
- padding: '16px 24px 140px',
+ padding: '16px 16px 140px',
}}>
+ {/* Hero heading */}
+ <div
+ style={{
+ maxWidth: 2000,
+ margin: '0 auto',
+ paddingBlock: 32,
+ textAlign: 'center',
+ }}>
+ <XDSText type="display-1">Craft what you imagine.</XDSText>
+ </div>
+
+ {/* Tab filters */}
+ <div
+ style={{
+ maxWidth: 2000,
+ margin: '0 auto 24px',
+ display: 'flex',
+ justifyContent: 'center',
+ }}>
+ <XDSTabList value={activeTab} onChange={setActiveTab} size="sm">
+ <XDSTab value="all" label="All" />
+ <XDSTab value="templates" label="Templates" />
+ <XDSTab value="theme" label="Theme" />
+ <XDSTab value="components" label="Components" />
+ </XDSTabList>
+ </div>
+
+ {/* Template grid */}
<div
style={{
maxWidth: 2000,
margin: '0 auto',
display: 'grid',
- gridTemplateColumns: isMobile
- ? '1fr'
- : isTablet
- ? 'repeat(2, 1fr)'
- : 'repeat(4, 1fr)',
+ gridTemplateColumns: isMobile ? '1fr' : 'repeat(2, 1fr)',
gap: 16,
gridAutoRows: '1fr',
}}>
@@ -575,7 +579,6 @@ function DocsiteLandingTemplate() {
onMoreLikeThis={() => handleMoreLikeThis(i)}
onUse={() => handleUse(i)}
onPreview={() => handlePreview(i)}
- simulation={simRef.current!}
/>
</div>
))}
@@ -588,97 +591,116 @@ function DocsiteLandingTemplate() {
{!chatOpen && <AIComposer />}
{/* Bottom drawer overlay */}
- {previewTarget !== null && (() => {
- const t = TEMPLATES[previewTarget % TEMPLATES.length];
- const isMeta = previewTarget === 3 && card4SelectedOption === 'meta';
- const moreLikeThisImages = TEMPLATES
- .map((tmpl, i) => ({src: tmpl.src, name: tmpl.name, description: `${tmpl.name} template`, originalIndex: i}))
- .filter(item => item.originalIndex !== previewTarget)
- .slice(0, 4);
- return (
- <>
- <style>{`
- @keyframes card4DrawerSlideUp {
- from { opacity: 0; }
- to { opacity: 1; }
- }
- @keyframes card4BackdropFadeIn {
- from { opacity: 0; }
- to { opacity: 1; }
- }
- `}</style>
- {/* Backdrop */}
- <div
- onClick={() => setPreviewTarget(null)}
- style={{
- position: 'fixed', inset: 0, zIndex: 100,
- backgroundColor: 'rgba(0,0,0,0.4)',
- backdropFilter: 'blur(2px)',
- animation: 'card4BackdropFadeIn 300ms ease',
+ {previewTarget !== null &&
+ (() => {
+ const t = TEMPLATES[previewTarget % TEMPLATES.length];
+ const isMeta = previewTarget === 3 && card4SelectedOption === 'meta';
+ const moreLikeThisImages = TEMPLATES.map((tmpl, i) => ({
+ src: tmpl.src,
+ name: tmpl.name,
+ description: `${tmpl.name} template`,
+ originalIndex: i,
+ }))
+ .filter(item => item.originalIndex !== previewTarget)
+ .slice(0, 4);
+ return (
+ <XDSDialog
+ isOpen={true}
+ onOpenChange={open => {
+ if (!open) setPreviewTarget(null);
}}
- />
- {/* Drawer */}
- <div style={{
- position: 'fixed', inset: 0, margin: 'auto', zIndex: 101,
- width: '90vw', maxWidth: 1200, height: 'fit-content', maxHeight: '90vh',
- backgroundColor: 'var(--color-background-card, #fff)',
- borderRadius: 16,
- boxShadow: '0 8px 60px rgba(0,0,0,0.2)',
- display: 'flex', flexDirection: 'column',
- animation: 'card4DrawerSlideUp 400ms cubic-bezier(0.16, 1, 0.3, 1)',
- overflow: 'visible',
- }}>
- {/* Floating close button — outside modal, top-right with 8px gap */}
- <div style={{position: 'absolute', top: 0, right: -44, zIndex: 1}}>
- <XDSButton
- label="Close"
- variant="secondary"
- size="sm"
- isIconOnly
- icon={<span style={{fontSize: 16, lineHeight: 1}}>✕</span>}
- onClick={() => setPreviewTarget(null)}
- style={{borderRadius: '50%', width: 36, height: 36, backgroundColor: '#fff', color: '#111', border: 'none', boxShadow: '0 2px 12px rgba(0,0,0,0.2)'}}
- />
+ width="90vw"
+ maxHeight="90vh"
+ purpose="info"
+ style={{padding: 0, overflow: 'visible'}}>
+ <div
+ style={{position: 'absolute', top: 0, right: -40, zIndex: 1}}>
+ <XDSCard padding={0} style={{borderRadius: '50%'}}>
+ <XDSButton
+ label="Close"
+ variant="ghost"
+ size="sm"
+ isIconOnly
+ icon={<span style={{fontSize: 16, lineHeight: 1}}>✕</span>}
+ onClick={() => setPreviewTarget(null)}
+ />
+ </XDSCard>
</div>
-
- {/* Scrollable content */}
- <div ref={card4ScrollRef} style={{overflowY: 'auto', borderRadius: 16}}>
+ <div ref={card4ScrollRef} style={{overflowY: 'auto'}}>
{/* Main content: image left + details right */}
<div style={{display: 'flex', minHeight: 0, padding: '0 24px'}}>
{/* Left — Preview image + thumbnails */}
- <div style={{flex: 1, minWidth: 0, padding: '24px 24px 24px 0', display: 'flex', flexDirection: 'column', gap: 12}}>
- <div style={{flex: 1, aspectRatio: '16 / 10', backgroundColor: 'var(--color-background-muted, #f9f9f9)', borderRadius: 12, overflowY: 'auto', overflowX: 'hidden', border: '1px solid var(--color-border, #e0e0e0)'}}>
+ <XDSStack
+ direction="vertical"
+ gap={3}
+ style={{flex: 1, minWidth: 0, padding: '24px 24px 24px 0'}}>
+ <div
+ style={{
+ flex: 1,
+ aspectRatio: '16 / 10',
+ backgroundColor:
+ 'var(--color-background-muted, #f9f9f9)',
+ borderRadius: 12,
+ overflowY: 'auto',
+ overflowX: 'hidden',
+ border: '1px solid var(--color-border, #e0e0e0)',
+ }}>
<img
- src={isMeta ? `${basePath}/templates/card4-preview-meta.png` : t.src}
+ src={
+ isMeta
+ ? `${basePath}/templates/card4-preview-meta.png`
+ : t.src
+ }
alt={t.name}
style={{width: '100%', display: 'block'}}
/>
</div>
- </div>
+ </XDSStack>
{/* Right — Details panel */}
- <div style={{width: 360, flexShrink: 0, padding: '24px 0', display: 'flex', flexDirection: 'column'}}>
+ <XDSStack
+ direction="vertical"
+ style={{width: 360, flexShrink: 0, padding: '24px 0'}}>
{/* Title */}
<XDSText type="display-2">{t.name}</XDSText>
{/* Description */}
<div style={{marginTop: 8}}>
<XDSText type="body" color="secondary">
- A ready-to-use {t.name.toLowerCase()} template built with XDS components. Customize it with your own content and theme to match your brand.
+ A ready-to-use {t.name.toLowerCase()} template built
+ with XDS components. Customize it with your own content
+ and theme to match your brand.
</XDSText>
</div>
{/* Author */}
- <div style={{marginTop: 16, display: 'flex', alignItems: 'center', gap: 12}}>
- <XDSAvatar name="Andrea Anderson" size={36} src={AVATAR_IMAGE} />
- <div style={{display: 'flex', flexDirection: 'column'}}>
- <XDSText type="supporting" color="secondary">Crafted by</XDSText>
- <XDSText type="body" style={{fontWeight: 600, fontSize: 16}}>Andrea Anderson</XDSText>
- </div>
- </div>
+ <XDSStack
+ direction="horizontal"
+ gap={3}
+ vAlign="center"
+ style={{marginTop: 16}}>
+ <XDSAvatar
+ name="Andrea Anderson"
+ size={36}
+ src={AVATAR_IMAGE}
+ />
+ <XDSStack direction="vertical">
+ <XDSText type="supporting" color="secondary">
+ Crafted by
+ </XDSText>
+ <XDSText
+ type="body"
+ style={{fontWeight: 600, fontSize: 16}}>
+ Andrea Anderson
+ </XDSText>
+ </XDSStack>
+ </XDSStack>
{/* CTA buttons */}
- <div style={{marginTop: 16, display: 'flex', flexDirection: 'column', gap: 8, position: 'relative'}}>
+ <XDSStack
+ direction="vertical"
+ gap={2}
+ style={{marginTop: 16, position: 'relative'}}>
<XDSButton
variant="primary"
label="Start crafting"
@@ -691,56 +713,89 @@ function DocsiteLandingTemplate() {
setChatOpen(true);
}}
/>
- <div style={{display: 'flex', gap: 8}} ref={card4AddPopoverRef}>
- <XDSButton
- ref={card4AddButtonRef}
- variant="secondary"
- label="Use in your product"
- size="lg"
- style={{flex: 1}}
- onClick={() => {
- if (card4AddButtonRef.current) {
- const rect = card4AddButtonRef.current.getBoundingClientRect();
- setCard4AddPopoverPos({top: rect.bottom + 8, left: rect.left});
- }
- setCard4ShowAddPopover(prev => !prev);
- }}
- />
+ <XDSStack
+ direction="horizontal"
+ gap={2}
+ style={{width: '100%'}}>
+ <XDSPopover
+ label="Add to project"
+ isOpen={card4ShowAddPopover}
+ onOpenChange={setCard4ShowAddPopover}
+ placement="below"
+ alignment="start"
+ width={340}
+ style={{flex: 1, minWidth: 0}}
+ content={
+ <SharePopoverContent
+ cliCommand={`npx xds template ${t.name.toLowerCase().replace(/\s+/g, '-')} ./my-project`}
+ onClose={() => setCard4ShowAddPopover(false)}
+ />
+ }>
+ <XDSButton
+ variant="secondary"
+ label="Use in your product"
+ size="lg"
+ style={{width: '100%'}}
+ />
+ </XDSPopover>
<XDSTooltip content="Bookmark">
<XDSButton
label={card4Bookmarked ? '893' : '892'}
variant="secondary"
size="lg"
isIconOnly
- icon={card4Bookmarked ? <BookmarkFilledIcon /> : <BookmarkIcon />}
+ icon={
+ card4Bookmarked ? (
+ <BookmarkFilledIcon />
+ ) : (
+ <BookmarkIcon />
+ )
+ }
onClick={() => setCard4Bookmarked(prev => !prev)}
/>
</XDSTooltip>
- {card4ShowAddPopover && card4AddPopoverPos && (
- <SharePopover
- cliCommand={`npx xds template ${t.name.toLowerCase().replace(/\s+/g, '-')} ./my-project`}
- position={card4AddPopoverPos}
- onClose={() => setCard4ShowAddPopover(false)}
- />
- )}
- </div>
- </div>
+ </XDSStack>
+ </XDSStack>
{/* Themes — pinned grid */}
<div style={{marginTop: 24}}>
- <div style={{display: 'flex', alignItems: 'center', justifyContent: 'space-between'}}>
- <XDSText type="body" style={{fontWeight: 600}}>Apply your themes</XDSText>
+ <div
+ style={{
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'space-between',
+ }}>
+ <XDSText type="body" style={{fontWeight: 600}}>
+ Apply your themes
+ </XDSText>
<XDSPopover
label="Browse themes"
placement="below"
alignment="end"
width={480}
isOpen={card4ThemeBrowse}
- onOpenChange={open => { setCard4ThemeBrowse(open); if (!open) setCard4ThemeSearch(''); }}
+ onOpenChange={open => {
+ setCard4ThemeBrowse(open);
+ if (!open) setCard4ThemeSearch('');
+ }}
xstyle={popoverStyles.themeBrowse}
content={
- <div style={{display: 'flex', flexDirection: 'column', gap: 16}}>
- <div tabIndex={0} style={{position: 'absolute', opacity: 0, width: 0, height: 0, overflow: 'hidden'}} />
+ <div
+ style={{
+ display: 'flex',
+ flexDirection: 'column',
+ gap: 16,
+ }}>
+ <div
+ tabIndex={0}
+ style={{
+ position: 'absolute',
+ opacity: 0,
+ width: 0,
+ height: 0,
+ overflow: 'hidden',
+ }}
+ />
<XDSTextInput
label="Search"
isLabelHidden
@@ -750,107 +805,278 @@ function DocsiteLandingTemplate() {
size="lg"
startIcon={SearchIcon}
/>
- <div style={{maxHeight: 560, overflowY: 'auto', display: 'flex', flexDirection: 'column', gap: 16}}>
- {(['official', 'community'] as const).map(category => {
- const entries = THEME_PICKER_ENTRIES.filter(
- e => e.category === category && e.name.toLowerCase().includes(card4ThemeSearch.toLowerCase()),
- );
- if (entries.length === 0) return null;
- return (
- <div key={category}>
- <div style={{marginBottom: 8}}>
- <XDSText type="supporting" color="secondary">
- {category.charAt(0).toUpperCase() + category.slice(1)}
- </XDSText>
- </div>
- <div style={{display: 'grid', gridTemplateColumns: '1fr 1fr 1fr', gap: 8}}>
- {entries.map(entry => {
- const isSelected = card4SelectedOption === entry.key;
- const isPinned = card4PinnedThemes.has(entry.key);
- const p = entry.preview;
- return (
- <div
- key={entry.key}
- style={{
- borderRadius: 12, overflow: 'hidden', cursor: 'pointer',
- border: isSelected ? '1.5px solid var(--color-accent)' : '1px solid var(--color-border-emphasized)',
- transition: 'border-color 0.15s ease',
- }}>
+ <div
+ style={{
+ maxHeight: 560,
+ overflowY: 'auto',
+ display: 'flex',
+ flexDirection: 'column',
+ gap: 16,
+ }}>
+ {(['official', 'community'] as const).map(
+ category => {
+ const entries = THEME_PICKER_ENTRIES.filter(
+ e =>
+ e.category === category &&
+ e.name
+ .toLowerCase()
+ .includes(
+ card4ThemeSearch.toLowerCase(),
+ ),
+ );
+ if (entries.length === 0) return null;
+ return (
+ <div key={category}>
+ <div style={{marginBottom: 8}}>
+ <XDSText
+ type="supporting"
+ color="secondary">
+ {category.charAt(0).toUpperCase() +
+ category.slice(1)}
+ </XDSText>
+ </div>
+ <div
+ style={{
+ display: 'grid',
+ gridTemplateColumns: '1fr 1fr 1fr',
+ gap: 8,
+ }}>
+ {entries.map(entry => {
+ const isSelected =
+ card4SelectedOption === entry.key;
+ const isPinned =
+ card4PinnedThemes.has(entry.key);
+ const p = entry.preview;
+ return (
<div
- onClick={() => { setCard4SelectedOption(entry.key); setCard4ThemeBrowse(false); setCard4ThemeSearch(''); }}
- style={{height: 100, backgroundColor: p.bg, display: 'flex', flexDirection: 'column', overflow: 'hidden'}}>
- <div style={{height: 14, backgroundColor: p.surface, borderBottom: `1px solid ${p.text}1A`, display: 'flex', alignItems: 'center', paddingInline: 8, gap: 4}}>
- <div style={{width: 5, height: 5, borderRadius: '50%', backgroundColor: p.accent}} />
- <div style={{width: 16, height: 2, borderRadius: 1, backgroundColor: p.text, opacity: 0.3}} />
- </div>
- <div style={{flex: 1, padding: 8, display: 'flex', flexDirection: 'column', gap: 5}}>
- <div style={{width: '65%', height: 4, borderRadius: 2, backgroundColor: p.text, opacity: 0.6}} />
- <div style={{width: '45%', height: 3, borderRadius: 1.5, backgroundColor: p.text, opacity: 0.25}} />
- <div style={{width: 28, height: 10, borderRadius: 4, backgroundColor: p.accent, marginTop: 'auto'}} />
- </div>
- </div>
- <div style={{display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '6px 8px', backgroundColor: 'var(--color-surface, #f5f5f5)'}}>
- <div style={{display: 'flex', alignItems: 'center', gap: 6}}>
- {(() => {
- const Logo = BRAND_LOGOS[entry.key];
- return Logo ? <Logo width={14} height={14} /> : (
- <div style={{width: 14, height: 14, borderRadius: '50%', backgroundColor: entry.accent}} />
+ key={entry.key}
+ style={{
+ borderRadius: 12,
+ overflow: 'hidden',
+ cursor: 'pointer',
+ border: isSelected
+ ? '1.5px solid var(--color-accent)'
+ : '1px solid var(--color-border-emphasized)',
+ transition:
+ 'border-color 0.15s ease',
+ }}>
+ <div
+ onClick={() => {
+ setCard4SelectedOption(
+ entry.key,
);
- })()}
- <XDSText type="supporting" style={{fontWeight: isSelected ? 600 : 400}}>{entry.name}</XDSText>
+ setCard4ThemeBrowse(false);
+ setCard4ThemeSearch('');
+ }}
+ style={{
+ height: 100,
+ backgroundColor: p.bg,
+ display: 'flex',
+ flexDirection: 'column',
+ overflow: 'hidden',
+ }}>
+ <div
+ style={{
+ height: 14,
+ backgroundColor:
+ p.surface,
+ borderBottom: `1px solid ${p.text}1A`,
+ display: 'flex',
+ alignItems: 'center',
+ paddingInline: 8,
+ gap: 4,
+ }}>
+ <div
+ style={{
+ width: 5,
+ height: 5,
+ borderRadius: '50%',
+ backgroundColor:
+ p.accent,
+ }}
+ />
+ <div
+ style={{
+ width: 16,
+ height: 2,
+ borderRadius: 1,
+ backgroundColor: p.text,
+ opacity: 0.3,
+ }}
+ />
+ </div>
+ <div
+ style={{
+ flex: 1,
+ padding: 8,
+ display: 'flex',
+ flexDirection: 'column',
+ gap: 5,
+ }}>
+ <div
+ style={{
+ width: '65%',
+ height: 4,
+ borderRadius: 2,
+ backgroundColor: p.text,
+ opacity: 0.6,
+ }}
+ />
+ <div
+ style={{
+ width: '45%',
+ height: 3,
+ borderRadius: 1.5,
+ backgroundColor: p.text,
+ opacity: 0.25,
+ }}
+ />
+ <div
+ style={{
+ width: 28,
+ height: 10,
+ borderRadius: 4,
+ backgroundColor:
+ p.accent,
+ marginTop: 'auto',
+ }}
+ />
+ </div>
</div>
<div
- onClick={e => { e.stopPropagation(); toggleCard4Pin(entry.key); }}
- style={{cursor: 'pointer', display: 'flex', padding: 2}}>
- {isPinned ? (
- <StarFilledIcon width={14} height={14} style={{color: 'var(--color-text-primary, #111)'}} />
- ) : (
- <StarIcon width={14} height={14} style={{color: 'var(--color-secondary, #999)'}} />
- )}
+ style={{
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent:
+ 'space-between',
+ padding: '6px 8px',
+ backgroundColor:
+ 'var(--color-surface, #f5f5f5)',
+ }}>
+ <div
+ style={{
+ display: 'flex',
+ alignItems: 'center',
+ gap: 6,
+ }}>
+ {(() => {
+ const Logo =
+ BRAND_LOGOS[entry.key];
+ return Logo ? (
+ <Logo
+ width={14}
+ height={14}
+ />
+ ) : (
+ <div
+ style={{
+ width: 14,
+ height: 14,
+ borderRadius: '50%',
+ backgroundColor:
+ entry.accent,
+ }}
+ />
+ );
+ })()}
+ <XDSText
+ type="supporting"
+ style={{
+ fontWeight: isSelected
+ ? 600
+ : 400,
+ }}>
+ {entry.name}
+ </XDSText>
+ </div>
+ <div
+ onClick={e => {
+ e.stopPropagation();
+ toggleCard4Pin(entry.key);
+ }}
+ style={{
+ cursor: 'pointer',
+ display: 'flex',
+ padding: 2,
+ }}>
+ {isPinned ? (
+ <StarFilledIcon
+ width={14}
+ height={14}
+ style={{
+ color:
+ 'var(--color-text-primary, #111)',
+ }}
+ />
+ ) : (
+ <StarIcon
+ width={14}
+ height={14}
+ style={{
+ color:
+ 'var(--color-secondary, #999)',
+ }}
+ />
+ )}
+ </div>
</div>
</div>
- </div>
- );
- })}
+ );
+ })}
+ </div>
</div>
- </div>
- );
- })}
+ );
+ },
+ )}
</div>
</div>
}>
- <button
- role="button"
- style={{
- background: 'none',
- border: 'none',
- padding: 0,
- cursor: 'pointer',
- font: 'inherit',
- }}>
- <XDSText type="supporting" color="secondary">Browse</XDSText>
- </button>
+ <XDSButton label="Browse" variant="ghost" size="sm" />
</XDSPopover>
</div>
- <div style={{display: 'grid', gridTemplateColumns: 'repeat(auto-fill, 44px)', gap: 8, marginTop: 16}}>
- {THEME_PICKER_ENTRIES.filter(e => card4PinnedThemes.has(e.key)).map(entry => {
+ <div
+ style={{
+ display: 'grid',
+ gridTemplateColumns: 'repeat(auto-fill, 44px)',
+ gap: 8,
+ marginTop: 16,
+ }}>
+ {THEME_PICKER_ENTRIES.filter(e =>
+ card4PinnedThemes.has(e.key),
+ ).map(entry => {
const isSelected = card4SelectedOption === entry.key;
const BrandLogo = BRAND_LOGOS[entry.key];
return (
<XDSTooltip key={entry.key} content={entry.name}>
<div
- onClick={() => setCard4SelectedOption(entry.key)}
+ onClick={() =>
+ setCard4SelectedOption(entry.key)
+ }
style={{
- width: 44, height: 44, borderRadius: 10,
- display: 'flex', alignItems: 'center', justifyContent: 'center', cursor: 'pointer',
- border: isSelected ? '1.5px solid var(--color-accent)' : '1px solid var(--color-border-emphasized)',
+ width: 44,
+ height: 44,
+ borderRadius: 10,
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ cursor: 'pointer',
+ border: isSelected
+ ? '1.5px solid var(--color-accent)'
+ : '1px solid var(--color-border-emphasized)',
backgroundColor: '#fff',
transition: 'border-color 0.15s ease',
}}>
{BrandLogo ? (
<BrandLogo width={28} height={28} />
) : (
- <div style={{width: 24, height: 24, borderRadius: '50%', backgroundColor: entry.accent}} />
+ <div
+ style={{
+ width: 24,
+ height: 24,
+ borderRadius: '50%',
+ backgroundColor: entry.accent,
+ }}
+ />
)}
</div>
</XDSTooltip>
@@ -858,24 +1084,46 @@ function DocsiteLandingTemplate() {
})}
</div>
</div>
-
- </div>
+ </XDSStack>
</div>
{/* More like this */}
<div style={{padding: '0 24px'}}>
<XDSHeading level={3}>More like this</XDSHeading>
- <div style={{display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: 12, marginTop: 16}}>
- {moreLikeThisImages.map((img) => (
+ <div
+ style={{
+ display: 'grid',
+ gridTemplateColumns: 'repeat(4, 1fr)',
+ gap: 12,
+ marginTop: 16,
+ }}>
+ {moreLikeThisImages.map(img => (
<XDSCard
key={img.originalIndex}
padding={0}
onClick={() => {
setPreviewTarget(img.originalIndex);
- card4ScrollRef.current?.scrollTo({top: 0, behavior: 'smooth'});
+ card4ScrollRef.current?.scrollTo({
+ top: 0,
+ behavior: 'smooth',
+ });
}}
- style={{cursor: 'pointer', aspectRatio: '16/10', overflow: 'hidden'}}>
- <img src={img.src} alt={img.name} style={{width: '100%', height: '100%', objectFit: 'cover', objectPosition: 'top', display: 'block'}} />
+ style={{
+ cursor: 'pointer',
+ aspectRatio: '16/10',
+ overflow: 'hidden',
+ }}>
+ <img
+ src={img.src}
+ alt={img.name}
+ style={{
+ width: '100%',
+ height: '100%',
+ objectFit: 'cover',
+ objectPosition: 'top',
+ display: 'block',
+ }}
+ />
</XDSCard>
))}
</div>
@@ -884,9 +1132,32 @@ function DocsiteLandingTemplate() {
{/* Explore more */}
<div style={{padding: '24px 24px 0'}}>
<XDSHeading level={3}>Explore more</XDSHeading>
- <div style={{display: 'flex', flexWrap: 'wrap', gap: 8, marginTop: 16}}>
- {['website', 'dashboard', 'admin panel', 'settings', 'form layout', 'data table', 'sidebar nav', 'landing page', 'e-commerce', 'documentation', 'profile page'].map(tag => (
- <XDSToken key={tag} label={tag} xstyle={tokenStyles.pill} style={{backgroundColor: 'transparent'}} />
+ <div
+ style={{
+ display: 'flex',
+ flexWrap: 'wrap',
+ gap: 8,
+ marginTop: 16,
+ }}>
+ {[
+ 'website',
+ 'dashboard',
+ 'admin panel',
+ 'settings',
+ 'form layout',
+ 'data table',
+ 'sidebar nav',
+ 'landing page',
+ 'e-commerce',
+ 'documentation',
+ 'profile page',
+ ].map(tag => (
+ <XDSToken
+ key={tag}
+ label={tag}
+ xstyle={tokenStyles.pill}
+ style={{backgroundColor: 'transparent'}}
+ />
))}
</div>
</div>
@@ -894,17 +1165,38 @@ function DocsiteLandingTemplate() {
{/* Component used */}
<div style={{padding: '24px 24px 24px'}}>
<XDSHeading level={3}>Component used</XDSHeading>
- <div style={{display: 'flex', flexWrap: 'wrap', gap: 8, marginTop: 16}}>
- {['XDSAppShell', 'XDSTopNav', 'XDSVStack', 'XDSHStack', 'XDSHeading', 'XDSText', 'XDSButton', 'XDSCard', 'XDSBadge', 'XDSAvatar'].map(c => (
- <XDSToken key={c} label={c} xstyle={tokenStyles.outline} style={{backgroundColor: 'transparent'}} />
+ <div
+ style={{
+ display: 'flex',
+ flexWrap: 'wrap',
+ gap: 8,
+ marginTop: 16,
+ }}>
+ {[
+ 'XDSAppShell',
+ 'XDSTopNav',
+ 'XDSVStack',
+ 'XDSHStack',
+ 'XDSHeading',
+ 'XDSText',
+ 'XDSButton',
+ 'XDSCard',
+ 'XDSBadge',
+ 'XDSAvatar',
+ ].map(c => (
+ <XDSToken
+ key={c}
+ label={c}
+ xstyle={tokenStyles.outline}
+ style={{backgroundColor: 'transparent'}}
+ />
))}
</div>
</div>
</div>
- </div>
- </>
- );
- })()}
- </div>
+ </XDSDialog>
+ );
+ })()}
+ </XDSAppShell>
);
}