Skip to content

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

TypeScript

feat(sandbox): docsite UI polish — floating toolbar, simplified overlays, full preview mode (#1378)

rubyycheung9d299af0c0a8
diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/AppTopNav.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/AppTopNav.tsx
index c7ad2f497d..dbf26ad7fa 100644
--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/AppTopNav.tsx
+++ b/apps/sandbox/src/app/(fullscreen)/pages/docsite/AppTopNav.tsx
@@ -126,7 +126,7 @@ export function AppTopNav({
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
- padding: '16px 16px 40px',
+ padding: '16px 16px 48px',
maxHeight: isScrolled ? 0 : 200,
overflow: 'hidden',
opacity: isScrolled ? 0 : 1,
@@ -135,7 +135,7 @@ export function AppTopNav({
...(isScrolled ? {padding: 0} : {}),
}}>
<div style={{textAlign: 'center'}}>
- <XDSText type="display-2">Craft what you imagine.</XDSText>
+ <XDSText type="display-1">Craft what you imagine.</XDSText>
</div>
</div>
diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/InlinePublishPanel.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/InlinePublishPanel.tsx
index ebf1fdaa0a..73d3af8519 100644
--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/InlinePublishPanel.tsx
+++ b/apps/sandbox/src/app/(fullscreen)/pages/docsite/InlinePublishPanel.tsx
@@ -86,9 +86,13 @@ export function InlinePublishPanel({
{/* 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="Publish template"
+ label="Submit template"
size="lg"
onClick={onPublish}
style={{width: '100%'}}
diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/SharePopover.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/SharePopover.tsx
index c8dc8c2805..c895f0e464 100644
--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/SharePopover.tsx
+++ b/apps/sandbox/src/app/(fullscreen)/pages/docsite/SharePopover.tsx
@@ -29,35 +29,27 @@ export function SharePopover({
borderRadius: 12,
boxShadow:
'0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08)',
- padding: 20,
+ padding: 16,
}}>
<XDSHeading level={3}>Add to your project</XDSHeading>
- <div style={{marginTop: 8}}>
+ <div style={{marginTop: 0}}>
<XDSText type="body" color="secondary">
Copy this snippet and paste it in your terminal to get started.
</XDSText>
</div>
- <div style={{marginTop: 12}}>
+ <div style={{marginTop: 16}}>
<XDSCard padding={0}>
<XDSCodeBlock code={cliCommand} language="bash" />
</XDSCard>
</div>
- <div
- style={{
- height: 1,
- backgroundColor: 'var(--color-divider, #e0e0e0)',
- margin: '16px 0',
- }}
- />
-
- <div style={{marginBottom: 8}}>
- <XDSText type="supporting" weight="semibold" color="secondary">
- Open in...
+ <div style={{marginTop: 16, marginBottom: 16}}>
+ <XDSText type="label" color="secondary">
+ Or open in
</XDSText>
</div>
- <XDSList>
+ <XDSList style={{margin: '-8px -8px -8px -8px'}}>
<XDSListItem
label="Claude Code"
startContent={
diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplateCard.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplateCard.tsx
index ff3170205c..78e0e285e6 100644
--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplateCard.tsx
+++ b/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplateCard.tsx
@@ -1,22 +1,13 @@
'use client';
-import React, {useState, useEffect, useRef} from 'react';
+import React, {useState, useEffect, useRef, useCallback} from 'react';
import {XDSCard} from '@xds/core/Card';
import {XDSButton} from '@xds/core/Button';
-import {XDSDropdownMenu} from '@xds/core/DropdownMenu';
import {XDSText} from '@xds/core/Text';
-import {
- LinkIcon,
- UploadIcon,
- HeartIcon,
- BookmarkIcon,
- TerminalIcon,
- ClaudeIcon,
- VSCodeIcon,
- CursorAIIcon,
-} from './docsite-icons';
+import {BookmarkIcon, BookmarkFilledIcon} from './docsite-icons';
import {BoidsCanvas} from './BoidsCanvas';
import type {BoidsSimulation} from './BoidsCanvas';
+import {SharePopover} from './SharePopover';
export function TemplateCard({
src,
@@ -45,6 +36,21 @@ export function TemplateCard({
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) {
@@ -111,64 +117,27 @@ export function TemplateCard({
inset: 0,
backgroundColor: 'var(--color-overlay, rgba(0,0,0,0.5))',
opacity: hovered ? 1 : 0,
- transition:
- 'opacity var(--duration-fast, 175ms) var(--ease-standard, cubic-bezier(0.24, 1, 0.4, 1))',
+ transition: 'opacity 300ms ease',
}}>
- {/* Top-right: action buttons */}
+ {/* Top-right: bookmark */}
<div
style={{
position: 'absolute',
- top: 8,
- right: 8,
- display: 'flex',
- alignItems: 'center',
- gap: 6,
+ top: 12,
+ right: 12,
}}
onClick={e => e.stopPropagation()}>
<XDSButton
- label="Link"
+ label="Bookmark"
variant="ghost"
size="sm"
isIconOnly
- icon={<LinkIcon />}
+ icon={bookmarked ? <BookmarkFilledIcon /> : <BookmarkIcon />}
style={{color: '#fff'}}
- onClick={() => {}}
+ onClick={() => setBookmarked(prev => !prev)}
/>
- <XDSButton
- label="Export"
- variant="ghost"
- size="sm"
- isIconOnly
- icon={<UploadIcon />}
- style={{color: '#fff'}}
- onClick={() => {}}
- />
- <div style={{display: 'flex', alignItems: 'center', gap: 2}}>
- <XDSButton
- label="Like"
- variant="ghost"
- size="sm"
- isIconOnly
- icon={<HeartIcon />}
- style={{color: '#fff'}}
- onClick={() => {}}
- />
- <span style={{color: '#fff', fontSize: 12, fontWeight: 500}}>1,645</span>
- </div>
- <div style={{display: 'flex', alignItems: 'center', gap: 2}}>
- <XDSButton
- label="Bookmark"
- variant="ghost"
- size="sm"
- isIconOnly
- icon={<BookmarkIcon />}
- style={{color: '#fff'}}
- onClick={() => {}}
- />
- <span style={{color: '#fff', fontSize: 12, fontWeight: 500}}>892</span>
- </div>
</div>
- {/* Bottom: template info + actions */}
+ {/* Bottom: info + actions */}
<div
onClick={e => e.stopPropagation()}
style={{
@@ -176,47 +145,33 @@ export function TemplateCard({
bottom: 0,
left: 0,
right: 0,
- padding: '24px 12px 12px',
- background: 'linear-gradient(to top, rgba(0,0,0,0.6), transparent)',
+ padding: 16,
+ background:
+ 'linear-gradient(to top, rgba(0,0,0,0.6), transparent)',
display: 'flex',
alignItems: 'flex-end',
justifyContent: 'space-between',
- transform: hovered ? 'translateY(0)' : 'translateY(16px)',
- opacity: hovered ? 1 : 0,
- transition:
- 'transform var(--duration-fast, 175ms) 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))',
}}>
{/* Template info */}
- <div style={{display: 'flex', flexDirection: 'column', gap: 2}}>
- <XDSText type="body" style={{color: '#fff', fontWeight: 700}}>
+ <div style={{display: 'flex', flexDirection: 'column', gap: 0}}>
+ <XDSText type="body" weight="bold" style={{color: '#fff'}}>
{name}
</XDSText>
- <XDSText type="supporting" style={{color: 'rgba(255,255,255,0.7)'}}>
+ <XDSText
+ type="supporting"
+ style={{color: 'rgba(255,255,255,0.7)'}}>
Andrea Anderson
</XDSText>
</div>
{/* Action buttons */}
- <div style={{display: 'flex', gap: 4}}>
- <XDSDropdownMenu
- button={{
- label: 'Use',
- variant: 'secondary',
- size: 'sm',
- style: {backgroundColor: 'var(--color-background-surface)'},
- }}
- hasChevron={false}
- menuWidth={220}
- items={[
- {
- label: 'Copy CLI Command...',
- icon: TerminalIcon,
- onClick: () => {},
- },
- {type: 'divider'},
- {label: 'Claude Code', icon: ClaudeIcon, onClick: () => {}},
- {label: 'VSCode', icon: VSCodeIcon, onClick: () => {}},
- {label: 'Cursor', icon: CursorAIIcon, onClick: () => {}},
- ]}
+ <div style={{display: 'flex', gap: 8}}>
+ <XDSButton
+ ref={useButtonRef}
+ label="Use"
+ variant="secondary"
+ size="sm"
+ style={{backgroundColor: 'var(--color-background-surface)'}}
+ onClick={handleUseClick}
/>
<XDSButton
label="Craft"
@@ -226,6 +181,13 @@ export function TemplateCard({
onClick={onUse}
/>
</div>
+ {showUsePopover && usePopoverPos && (
+ <SharePopover
+ cliCommand={`npx xds template ${name.toLowerCase().replace(/\s+/g, '-')}`}
+ position={usePopoverPos}
+ onClose={() => setShowUsePopover(false)}
+ />
+ )}
</div>
</div>
)}
diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplateFullPreview.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplateFullPreview.tsx
index b64d8e8224..02de3e0c97 100644
--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplateFullPreview.tsx
+++ b/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplateFullPreview.tsx
@@ -25,12 +25,9 @@ import {
PaletteIcon,
ContrastIcon,
SaveIcon,
- ShareIcon,
PlusIcon,
SendIcon,
- LinkIcon,
CheckIcon,
- HeartIcon,
BookmarkIcon,
BookmarkFilledIcon,
StarIcon,
@@ -117,27 +114,17 @@ export function TemplateFullPreview({
const [chatInput, setChatInput] = useState('');
const [codeContent, setCodeContent] = useState(MOCK_CODE);
const [showPublishModal, setShowPublishModal] = useState(false);
- const [showSharePopover, setShowSharePopover] = useState(false);
const [showSendPopover, setShowSendPopover] = useState(false);
const [sendPopoverPos, setSendPopoverPos] = useState(
null as {top: number; left: number} | null,
);
- const [sharePopoverPos, setSharePopoverPos] = useState(
- null as {top: number; left: number} | null,
- );
- const [shareCopied, setShareCopied] = useState(false);
const [sendCopied, setSendCopied] = useState(false);
- const [linkCopied, setLinkCopied] = useState(false);
- const [liked, setLiked] = useState(false);
- const [likeCount, setLikeCount] = useState(1645);
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 sharePopoverRef = useRef(null as HTMLDivElement | null);
- const shareButtonRef = useRef(null as HTMLButtonElement | null);
const sendPopoverRef = useRef(null as HTMLDivElement | null);
const shareCliCommand = `npx xds template ${templateName.toLowerCase().replace(/\s+/g, '-')} ./my-project`;
@@ -148,19 +135,6 @@ export function TemplateFullPreview({
});
}, []);
- useEffect(() => {
- if (!showSharePopover) return;
- const handleClickOutside = (e: MouseEvent) => {
- if (
- sharePopoverRef.current &&
- !sharePopoverRef.current.contains(e.target as Node)
- ) {
- setShowSharePopover(false);
- }
- };
- document.addEventListener('mousedown', handleClickOutside);
- return () => document.removeEventListener('mousedown', handleClickOutside);
- }, [showSharePopover]);
useEffect(() => {
if (!showSendPopover) return;
@@ -365,8 +339,6 @@ export function TemplateFullPreview({
'https://xds.dev/templates/' +
templateName.toLowerCase().replace(/\s+/g, '-'),
);
- setLinkCopied(true);
- setTimeout(() => setLinkCopied(false), 2000);
}}>
<XDSText type="display-2">
{templateName}
@@ -411,69 +383,6 @@ export function TemplateFullPreview({
</div>
</div>
- {/* Stats buttons */}
- <div
- style={{
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'space-between',
- marginTop: 16,
- marginLeft: -8,
- marginRight: -8,
- }}>
- <div style={{display: 'flex', alignItems: 'center', gap: 4}}>
- <XDSTooltip content="Copy link">
- <XDSButton
- label="Link"
- variant="ghost"
- size="sm"
- isIconOnly
- icon={
- linkCopied ? (
- <CheckIcon
- style={{
- strokeDasharray: 24,
- strokeDashoffset: 0,
- animation: 'checkDraw 0.3s ease-out',
- }}
- />
- ) : (
- <LinkIcon />
- )
- }
- onClick={() => {
- void navigator.clipboard.writeText(
- 'https://xds.dev/templates/' +
- templateName.toLowerCase().replace(/\s+/g, '-'),
- );
- setLinkCopied(true);
- setTimeout(() => setLinkCopied(false), 2000);
- }}
- />
- </XDSTooltip>
- </div>
- <div style={{display: 'flex', alignItems: 'center', gap: 4}}>
- <XDSTooltip content="Like">
- <XDSButton
- label={likeCount.toLocaleString()}
- variant="ghost"
- size="sm"
- style={{color: 'var(--color-text-secondary, #65676B)'}}
- icon={
- <HeartIcon
- fill={liked ? 'currentColor' : 'none'}
- style={liked ? {color: '#e5484d'} : undefined}
- />
- }
- onClick={() => {
- setLiked(prev => !prev);
- setLikeCount(prev => (liked ? prev - 1 : prev + 1));
- }}
- />
- </XDSTooltip>
- </div>
- </div>
-
{/* CTA buttons */}
{!showEditor && (
<div style={{marginTop: 16, display: 'flex', flexDirection: 'column', gap: 8, position: 'relative'}}>
@@ -1051,47 +960,6 @@ export function TemplateFullPreview({
onClick={() => {}}
/>
</XDSTooltip>
- <div
- ref={sharePopoverRef}
- style={{position: 'relative' as const}}>
- <XDSTooltip content="Share">
- <XDSButton
- label="Share"
- variant="ghost"
- isIconOnly
- icon={<ShareIcon />}
- ref={shareButtonRef}
- onClick={() => {
- setShowSharePopover(prev => {
- if (!prev && shareButtonRef.current) {
- const rect =
- shareButtonRef.current.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;
- });
- }}
- />
- </XDSTooltip>
- {showSharePopover && sharePopoverPos && (
- <SharePopover
- cliCommand={shareCliCommand}
- position={sharePopoverPos}
- onClose={() => setShowSharePopover(false)}
- />
- )}
- </div>
<XDSButton
label="Publish"
variant="primary"
diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplatePreview.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplatePreview.tsx
index aa2c625705..8b69924534 100644
--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplatePreview.tsx
+++ b/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplatePreview.tsx
@@ -1,12 +1,13 @@
'use client';
-import React, {useState, useEffect, useRef} from 'react';
+import React, {useState, useEffect, useRef, useCallback} from 'react';
import {XDSButton} from '@xds/core/Button';
import {XDSDropdownMenu} from '@xds/core/DropdownMenu';
import {
XDSSegmentedControl,
XDSSegmentedControlItem,
} from '@xds/core/SegmentedControl';
+import {XDSSpinner} from '@xds/core/Spinner';
import {XDSToolbar} from '@xds/core/Toolbar';
import {XDSTooltip} from '@xds/core/Tooltip';
@@ -18,7 +19,11 @@ import {
ContrastIcon,
SaveIcon,
ShareIcon,
+ ShareOutIcon,
+ FullscreenIcon,
+ MoonIcon,
LinkIcon,
+ CheckIcon,
} from './docsite-icons';
import {SharePopover} from './SharePopover';
@@ -40,6 +45,9 @@ export function TemplatePreview({
hideToolbar = false,
externalViewportSize,
isPublishing = false,
+ isFullPreview = false,
+ onFullPreviewChange,
+ previewBackground,
}: {
templateName: string;
imageSrc: string;
@@ -53,12 +61,31 @@ export function TemplatePreview({
hideToolbar?: boolean;
externalViewportSize?: string;
isPublishing?: boolean;
+ isFullPreview?: boolean;
+ onFullPreviewChange?: (full: boolean) => void;
+ previewBackground?: string;
}) {
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 [linkCopied, setLinkCopied] = useState(false);
+ const [isScrolled, setIsScrolled] = useState(false);
+
+ const handleSave = useCallback(() => {
+ setSaveState('saving');
+ setTimeout(() => setSaveState('saved'), 1200);
+ }, []);
+
+ const handleCopyLink = useCallback(() => {
+ navigator.clipboard.writeText(window.location.href);
+ setLinkCopied(true);
+ setTimeout(() => setLinkCopied(false), 2000);
+ }, []);
+ 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);
@@ -77,6 +104,14 @@ export function TemplatePreview({
return () => document.removeEventListener('mousedown', handleClickOutside);
}, [showSharePopover]);
+ useEffect(() => {
+ const el = scrollRef.current;
+ if (!el) return;
+ const handleScroll = () => setIsScrolled(el.scrollTop > 8);
+ el.addEventListener('scroll', handleScroll, {passive: true});
+ return () => el.removeEventListener('scroll', handleScroll);
+ }, []);
+
useEffect(() => {
if (isGenerating && previewRef.current) {
const rect = (previewRef.current as HTMLElement).getBoundingClientRect();
@@ -100,55 +135,60 @@ export function TemplatePreview({
height: '100%',
overflow: 'visible',
paddingTop: 0,
+ position: 'relative' as const,
}}>
- {/* Bordered container: toolbar + preview/code/publish */}
- <div
- style={{
- flex: 1,
- overflow: 'visible',
- padding: 0,
- display: 'flex',
- flexDirection: 'column' as const,
- minHeight: 0,
- }}>
- {/* Toolbar */}
- {!hideToolbar && <div
+ {/* Toolbar — outside overflow:hidden so dropdowns aren't clipped */}
+ {!hideToolbar && <div
style={{
- backgroundColor: 'var(--color-background-body, #f5f5f5)',
- position: 'relative',
+ background: 'none',
+ position: 'absolute',
+ top: 0,
+ left: 0,
+ right: 0,
zIndex: 10,
- flexShrink: 0,
+ paddingTop: 8,
+ display: 'flex',
+ justifyContent: 'center',
+ }}>
+ <div style={{
+ backgroundColor: isScrolled ? 'var(--color-background-card, #fff)' : (previewBackground ?? 'var(--color-background-card, #fff)'),
+ borderRadius: 'var(--radius-container, 12px)',
+ border: 'none',
+ display: 'inline-flex',
+ padding: '4px 0',
+ boxShadow: isScrolled ? '0 2px 8px rgba(0,0,0,0.12)' : 'none',
+ transition: 'background-color 200ms ease, box-shadow 300ms ease',
}}>
<XDSToolbar
label="Template actions"
- padding={1}
- startContent={<></>}
+ padding={0}
centerContent={
- <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>
- }
- endContent={
- isPublishing ? undefined : (
+ 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>
+ </>
+ ) : (
<>
<XDSTooltip content="Point">
<XDSButton
@@ -174,43 +214,73 @@ export function TemplatePreview({
}))}
/>
</XDSTooltip>
- <XDSTooltip content="Toggle theme">
+ <XDSTooltip content={isDarkMode ? "Dark mode" : "Light mode"}>
<XDSButton
- label="Toggle theme"
+ label={isDarkMode ? "Dark mode" : "Light mode"}
variant="ghost"
isIconOnly
- icon={<ContrastIcon />}
+ icon={isDarkMode ? <MoonIcon /> : <ContrastIcon />}
+ onClick={() => setIsDarkMode(prev => !prev)}
/>
</XDSTooltip>
- <div
- style={{
- width: 1,
- height: 20,
- backgroundColor: 'var(--color-border-strong, #999)',
- margin: '0 4px',
- flexShrink: 0,
- }}
- />
- <XDSTooltip content="Copy link">
- <XDSButton
- label="Copy link"
- variant="ghost"
- icon={<LinkIcon />}
- isIconOnly
- onClick={() => {}}
- />
- </XDSTooltip>
- <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={() => {}}
+ icon={<FullscreenIcon />}
+ onClick={() => onFullPreviewChange?.(true)}
/>
</XDSTooltip>
+ {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="Publish"
+ label="Submit"
variant="secondary"
size="sm"
onClick={() => onPublish?.()}
@@ -218,7 +288,7 @@ export function TemplatePreview({
<div
style={{position: 'relative'}}>
<XDSButton
- label="Use in product"
+ label="Use"
variant="primary"
size="sm"
ref={shareButtonRef}
@@ -256,11 +326,43 @@ export function TemplatePreview({
)
}
/>
+ </div>
</div>}
+ {/* Bordered container: preview/code/publish */}
+ <div
+ style={{
+ flex: 1,
+ overflow: previewBackground ? 'visible' : 'hidden',
+ padding: 0,
+ display: 'flex',
+ flexDirection: 'column' as const,
+ minHeight: 0,
+ position: 'relative' as const,
+ }}>
+ {/* 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>
+ )}
+
{/* Preview — full-bleed image */}
<div
- ref={previewRef}
+ ref={(el) => {
+ (previewRef as React.MutableRefObject<HTMLDivElement | null>).current = el;
+ (scrollRef as React.MutableRefObject<HTMLDivElement | null>).current = el;
+ }}
style={{
position: 'relative',
flex: 1,
@@ -268,8 +370,8 @@ export function TemplatePreview({
display: 'flex',
justifyContent: 'center',
alignItems: 'flex-start',
- backgroundColor: 'var(--color-background-body, #f5f5f5)',
- padding: viewportSize === 'phone' ? 24 : 16,
+ 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',
}}
@@ -283,22 +385,29 @@ export function TemplatePreview({
});
onPointingChange?.(false);
} : undefined}>
- <img
- src={imageSrc}
- alt="Template preview"
- style={{
- display: 'block',
- width: viewportSize === 'phone' ? 375 : '100%',
- aspectRatio: viewportSize === 'phone' ? '9 / 19.5' : undefined,
- objectFit: viewportSize === 'phone' ? 'cover' : undefined,
- borderRadius: viewportSize === 'phone' ? 36 : 12,
- boxShadow: viewportSize === 'phone'
- ? '0 8px 40px rgba(0,0,0,0.15)'
- : '0 1px 3px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.06)',
- opacity: isGenerating ? 0 : 1,
- transition: 'width 300ms ease, border-radius 300ms ease, box-shadow 300ms ease, opacity 600ms ease',
- }}
- />
+ <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',
+ 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>
{showCanvas && (
<div
style={{
diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/docsite-icons.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/docsite-icons.tsx
index 7b8b9a1a99..219b89de54 100644
--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/docsite-icons.tsx
+++ b/apps/sandbox/src/app/(fullscreen)/pages/docsite/docsite-icons.tsx
@@ -18,6 +18,8 @@ export {
ArrowUpTrayIcon as ShareIcon,
ArrowDownTrayIcon as DownloadIcon,
ArrowTopRightOnSquareIcon as ExternalLinkIcon,
+ ArrowUpOnSquareIcon as ShareOutIcon,
+ MoonIcon,
ArrowsPointingOutIcon as FullscreenIcon,
Bars3Icon as HamburgerIcon,
CodeBracketIcon as CodeIcon,
@@ -39,33 +41,42 @@ export {BookmarkIcon as BookmarkFilledIcon, StarIcon as StarFilledIcon} from '@h
// Brand logos for theme picker
-export const MetaLogo = (props: React.SVGProps<SVGSVGElement>) => (
- <svg viewBox="0 0 287.56 191" fill="none" {...props}>
- <defs>
- <linearGradient id="meta-g1" x1="61" y1="117" x2="259" y2="127" gradientUnits="userSpaceOnUse">
- <stop offset="0" stopColor="#0064e1" /><stop offset="0.4" stopColor="#0064e1" /><stop offset="0.83" stopColor="#0073ee" /><stop offset="1" stopColor="#0082fb" />
- </linearGradient>
- <linearGradient id="meta-g2" x1="45" y1="139" x2="45" y2="66" gradientUnits="userSpaceOnUse">
- <stop offset="0" stopColor="#0082fb" /><stop offset="1" stopColor="#0064e0" />
- </linearGradient>
- </defs>
- <path fill="#0081fb" d="m31.06,125.96c0,10.98 2.41,19.41 5.56,24.51 4.13,6.68 10.29,9.51 16.57,9.51 8.1,0 15.51-2.01 29.79-21.76 11.44-15.83 24.92-38.05 33.99-51.98l15.36-23.6c10.67-16.39 23.02-34.61 37.18-46.96 11.56-10.08 24.03-15.68 36.58-15.68 21.07,0 41.14,12.21 56.5,35.11 16.81,25.08 24.97,56.67 24.97,89.27 0,19.38-3.82,33.62-10.32,44.87-6.28,10.88-18.52,21.75-39.11,21.75l0-31.02c17.63,0 22.03-16.2 22.03-34.74 0-26.42-6.16-55.74-19.73-76.69-9.63-14.86-22.11-23.94-35.84-23.94-14.85,0-26.8,11.2-40.23,31.17-7.14,10.61-14.47,23.54-22.7,38.13l-9.06,16.05c-18.2,32.27-22.81,39.62-31.91,51.75-15.95,21.24-29.57,29.29-47.5,29.29-21.27,0-34.72-9.21-43.05-23.09-6.8-11.31-10.14-26.15-10.14-43.06z" />
- <path fill="url(#meta-g1)" d="m24.49,37.3c14.24-21.95 34.79-37.3 58.36-37.3 13.65,0 27.22,4.04 41.39,15.61 15.5,12.65 32.02,33.48 52.63,67.81l7.39,12.32c17.84,29.72 27.99,45.01 33.93,52.22 7.64,9.26 12.99,12.02 19.94,12.02 17.63,0 22.03-16.2 22.03-34.74l27.4-.86c0,19.38-3.82,33.62-10.32,44.87-6.28,10.88-18.52,21.75-39.11,21.75-12.8,0-24.14-2.78-36.68-14.61-9.64-9.08-20.91-25.21-29.58-39.71l-25.79-43.08c-12.94-21.62-24.81-37.74-31.68-45.04-7.39-7.85-16.89-17.33-32.05-17.33-12.27,0-22.69,8.61-31.41,21.78z" />
- <path fill="url(#meta-g2)" d="m82.35,31.23c-12.27,0-22.69,8.61-31.41,21.78-12.33,18.61-19.88,46.33-19.88,72.95 0,10.98 2.41,19.41 5.56,24.51l-26.48,17.44c-6.8-11.31-10.14-26.15-10.14-43.06 0-30.75 8.44-62.8 24.49-87.55 14.24-21.95 34.79-37.3 58.36-37.3z" />
- </svg>
-);
-
-export const WhatsAppLogo = (props: React.SVGProps<SVGSVGElement>) => (
- <svg viewBox="0 0 175.216 175.552" fill="none" {...props}>
- <defs>
- <linearGradient id="wa-g" x1="85.915" y1="32.567" x2="86.535" y2="137.092" gradientUnits="userSpaceOnUse">
- <stop offset="0" stopColor="#57d163" /><stop offset="1" stopColor="#23b33a" />
- </linearGradient>
- </defs>
- <path fill="url(#wa-g)" d="M87.184 25.227c-33.733 0-61.166 27.423-61.178 61.13a60.98 60.98 0 009.349 32.535l1.455 2.313-6.179 22.558 23.146-6.069 2.235 1.324c9.387 5.571 20.15 8.517 31.126 8.523h.023c33.707 0 61.14-27.426 61.153-61.135a60.75 60.75 0 00-17.895-43.251 60.75 60.75 0 00-43.235-17.928z" />
- <path fill="#fff" fillRule="evenodd" d="M68.772 55.603c-1.378-3.061-2.828-3.123-4.137-3.176l-3.524-.043c-1.226 0-3.218.46-4.902 2.3s-6.435 6.287-6.435 15.332 6.588 17.785 7.506 19.013 12.718 20.381 31.405 27.75c15.529 6.124 18.689 4.906 22.061 4.6s10.877-4.447 12.408-8.74 1.532-7.971 1.073-8.74-1.685-1.226-3.525-2.146-10.877-5.367-12.562-5.981-2.91-.919-4.137.921-4.746 5.979-5.819 7.206-2.144 1.381-3.984.462-7.76-2.861-14.784-9.124c-5.465-4.873-9.154-10.891-10.228-12.73s-.114-2.835.808-3.751c.825-.824 1.838-2.147 2.759-3.22s1.224-1.84 1.836-3.065.307-2.301-.153-3.22-4.032-10.011-5.666-13.647" />
- </svg>
-);
+export function MetaLogo(props: React.SVGProps<SVGSVGElement>) {
+ const id = React.useId();
+ const g1 = `meta-g1-${id}`;
+ const g2 = `meta-g2-${id}`;
+ return (
+ <svg viewBox="0 0 287.56 191" fill="none" {...props}>
+ <defs>
+ <linearGradient id={g1} x1="61" y1="117" x2="259" y2="127" gradientUnits="userSpaceOnUse">
+ <stop offset="0" stopColor="#0064e1" /><stop offset="0.4" stopColor="#0064e1" /><stop offset="0.83" stopColor="#0073ee" /><stop offset="1" stopColor="#0082fb" />
+ </linearGradient>
+ <linearGradient id={g2} x1="45" y1="139" x2="45" y2="66" gradientUnits="userSpaceOnUse">
+ <stop offset="0" stopColor="#0082fb" /><stop offset="1" stopColor="#0064e0" />
+ </linearGradient>
+ </defs>
+ <path fill="#0081fb" d="m31.06,125.96c0,10.98 2.41,19.41 5.56,24.51 4.13,6.68 10.29,9.51 16.57,9.51 8.1,0 15.51-2.01 29.79-21.76 11.44-15.83 24.92-38.05 33.99-51.98l15.36-23.6c10.67-16.39 23.02-34.61 37.18-46.96 11.56-10.08 24.03-15.68 36.58-15.68 21.07,0 41.14,12.21 56.5,35.11 16.81,25.08 24.97,56.67 24.97,89.27 0,19.38-3.82,33.62-10.32,44.87-6.28,10.88-18.52,21.75-39.11,21.75l0-31.02c17.63,0 22.03-16.2 22.03-34.74 0-26.42-6.16-55.74-19.73-76.69-9.63-14.86-22.11-23.94-35.84-23.94-14.85,0-26.8,11.2-40.23,31.17-7.14,10.61-14.47,23.54-22.7,38.13l-9.06,16.05c-18.2,32.27-22.81,39.62-31.91,51.75-15.95,21.24-29.57,29.29-47.5,29.29-21.27,0-34.72-9.21-43.05-23.09-6.8-11.31-10.14-26.15-10.14-43.06z" />
+ <path fill={`url(#${g1})`} d="m24.49,37.3c14.24-21.95 34.79-37.3 58.36-37.3 13.65,0 27.22,4.04 41.39,15.61 15.5,12.65 32.02,33.48 52.63,67.81l7.39,12.32c17.84,29.72 27.99,45.01 33.93,52.22 7.64,9.26 12.99,12.02 19.94,12.02 17.63,0 22.03-16.2 22.03-34.74l27.4-.86c0,19.38-3.82,33.62-10.32,44.87-6.28,10.88-18.52,21.75-39.11,21.75-12.8,0-24.14-2.78-36.68-14.61-9.64-9.08-20.91-25.21-29.58-39.71l-25.79-43.08c-12.94-21.62-24.81-37.74-31.68-45.04-7.39-7.85-16.89-17.33-32.05-17.33-12.27,0-22.69,8.61-31.41,21.78z" />
+ <path fill={`url(#${g2})`} d="m82.35,31.23c-12.27,0-22.69,8.61-31.41,21.78-12.33,18.61-19.88,46.33-19.88,72.95 0,10.98 2.41,19.41 5.56,24.51l-26.48,17.44c-6.8-11.31-10.14-26.15-10.14-43.06 0-30.75 8.44-62.8 24.49-87.55 14.24-21.95 34.79-37.3 58.36-37.3z" />
+ </svg>
+ );
+}
+
+export function WhatsAppLogo(props: React.SVGProps<SVGSVGElement>) {
+ const id = React.useId();
+ const gId = `wa-g-${id}`;
+ return (
+ <svg viewBox="0 0 175.216 175.552" fill="none" {...props}>
+ <defs>
+ <linearGradient id={gId} x1="85.915" y1="32.567" x2="86.535" y2="137.092" gradientUnits="userSpaceOnUse">
+ <stop offset="0" stopColor="#57d163" /><stop offset="1" stopColor="#23b33a" />
+ </linearGradient>
+ </defs>
+ <path fill={`url(#${gId})`} d="M87.184 25.227c-33.733 0-61.166 27.423-61.178 61.13a60.98 60.98 0 009.349 32.535l1.455 2.313-6.179 22.558 23.146-6.069 2.235 1.324c9.387 5.571 20.15 8.517 31.126 8.523h.023c33.707 0 61.14-27.426 61.153-61.135a60.75 60.75 0 00-17.895-43.251 60.75 60.75 0 00-43.235-17.928z" />
+ <path fill="#fff" fillRule="evenodd" d="M68.772 55.603c-1.378-3.061-2.828-3.123-4.137-3.176l-3.524-.043c-1.226 0-3.218.46-4.902 2.3s-6.435 6.287-6.435 15.332 6.588 17.785 7.506 19.013 12.718 20.381 31.405 27.75c15.529 6.124 18.689 4.906 22.061 4.6s10.877-4.447 12.408-8.74 1.532-7.971 1.073-8.74-1.685-1.226-3.525-2.146-10.877-5.367-12.562-5.981-2.91-.919-4.137.921-4.746 5.979-5.819 7.206-2.144 1.381-3.984.462-7.76-2.861-14.784-9.124c-5.465-4.873-9.154-10.891-10.228-12.73s-.114-2.835.808-3.751c.825-.824 1.838-2.147 2.759-3.22s1.224-1.84 1.836-3.065.307-2.301-.153-3.22-4.032-10.011-5.666-13.647" />
+ </svg>
+ );
+}
export const PinIcon = (props: React.SVGProps<SVGSVGElement>) => (
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round" {...props}>
diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/page.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/page.tsx
index 0337ab947e..2506af75b1 100644
--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/page.tsx
+++ b/apps/sandbox/src/app/(fullscreen)/pages/docsite/page.tsx
@@ -27,7 +27,7 @@ import {
XDSSegmentedControl,
XDSSegmentedControlItem,
} from '@xds/core/SegmentedControl';
-import {XDSDialog, XDSDialogHeader} from '@xds/core/Dialog';
+import {XDSPopover} from '@xds/core/Popover';
import {XDSTextInput} from '@xds/core/TextInput';
import {XDSToolbar} from '@xds/core/Toolbar';
import {XDSTooltip} from '@xds/core/Tooltip';
@@ -81,6 +81,12 @@ const tokenStyles = stylex.create({
},
});
+const popoverStyles = stylex.create({
+ themeBrowse: {
+ padding: 16,
+ },
+});
+
// ---------------------------------------------------------------------------
// Page
// ---------------------------------------------------------------------------
@@ -127,6 +133,7 @@ function DocsiteLandingTemplate() {
const [editorPanelWidth, setEditorPanelWidth] = useState(380);
const [isEditorResizing, setIsEditorResizing] = useState(false);
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);
@@ -307,7 +314,7 @@ function DocsiteLandingTemplate() {
display: 'flex',
height: '100vh',
overflow: 'hidden',
- backgroundColor: 'var(--color-background-body, #f5f5f5)',
+ 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); } }' +
@@ -316,7 +323,7 @@ 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>
- <div
+ {!fullPreview && <div
style={{
width: editorPanelWidth,
minWidth: 280,
@@ -332,7 +339,7 @@ function DocsiteLandingTemplate() {
flex: 1,
backgroundColor: 'var(--color-background-card, #fff)',
borderRadius: 16,
- boxShadow: '0 4px 24px rgba(0,0,0,0.08)',
+ border: useTarget !== 3 ? 'none' : '1px solid var(--color-divider, #e0e0e0)',
overflow: 'hidden',
display: 'flex',
flexDirection: 'column' as const,
@@ -409,21 +416,22 @@ function DocsiteLandingTemplate() {
/>
)}
</div>
- </div>
+ </div>}
{/* Resize handle */}
- <div
+ {!fullPreview && <div
onMouseDown={handleEditorResizeStart}
data-resizing={isEditorResizing}
className="xds-editor-resize-grip"
style={{
- width: 12,
+ width: 16,
flexShrink: 0,
cursor: 'col-resize',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
zIndex: 10,
- backgroundColor: 'var(--color-background-body, #f5f5f5)',
+ backgroundColor: 'transparent',
+ marginRight: useTarget !== 3 ? -16 : 0,
}}>
<div
className="xds-editor-resize-handle"
@@ -436,9 +444,9 @@ function DocsiteLandingTemplate() {
: 'var(--color-border-strong, #ccc)',
}}
/>
- </div>
+ </div>}
<div
- style={{flex: 1, display: 'flex', flexDirection: 'column' as const, minWidth: 0, overflow: 'hidden'}}>
+ style={{flex: 1, display: 'flex', flexDirection: 'column' as const, minWidth: 0, overflow: 'visible'}}>
<TemplatePreview
templateName={t.name}
imageSrc={t.src}
@@ -453,6 +461,10 @@ function DocsiteLandingTemplate() {
setPanelTab('properties');
}}
isPublishing={showPublishCard1}
+ isFullPreview={fullPreview}
+ onFullPreviewChange={setFullPreview}
+ hideToolbar={fullPreview}
+ previewBackground={useTarget !== 3 ? 'var(--color-background-body)' : undefined}
/>
</div>
</div>
@@ -526,7 +538,7 @@ function DocsiteLandingTemplate() {
style={{
flex: 1,
overflow: 'auto',
- padding: '16px 24px',
+ padding: '16px 24px 140px',
}}>
<div
style={{
@@ -632,20 +644,20 @@ function DocsiteLandingTemplate() {
{/* Scrollable content */}
<div ref={card4ScrollRef} style={{overflowY: 'auto', borderRadius: 16}}>
{/* Main content: image left + details right */}
- <div style={{display: 'flex', minHeight: 0, padding: '0 32px'}}>
+ <div style={{display: 'flex', minHeight: 0, padding: '0 24px'}}>
{/* Left — Preview image + thumbnails */}
- <div style={{flex: 1, minWidth: 0, padding: '32px 32px 32px 0', display: 'flex', flexDirection: 'column', gap: 12}}>
- <div style={{flex: 1, aspectRatio: '16 / 10', backgroundColor: 'var(--color-background-muted, #f9f9f9)', borderRadius: 12, overflow: 'hidden', border: '1px solid var(--color-border, #e0e0e0)'}}>
+ <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)'}}>
<img
src={isMeta ? `${basePath}/templates/card4-preview-meta.png` : t.src}
alt={t.name}
- style={{width: '100%', height: '100%', objectFit: 'cover', objectPosition: 'top'}}
+ style={{width: '100%', display: 'block'}}
/>
</div>
</div>
{/* Right — Details panel */}
- <div style={{width: 360, flexShrink: 0, padding: '32px 0', display: 'flex', flexDirection: 'column'}}>
+ <div style={{width: 360, flexShrink: 0, padding: '24px 0', display: 'flex', flexDirection: 'column'}}>
{/* Title */}
<XDSText type="display-2">{t.name}</XDSText>
@@ -667,17 +679,31 @@ function DocsiteLandingTemplate() {
{/* CTA buttons */}
<div style={{marginTop: 16, display: 'flex', flexDirection: 'column', gap: 8, position: 'relative'}}>
- <div style={{display: 'flex', gap: 8}}>
+ <XDSButton
+ variant="primary"
+ label="Start crafting"
+ size="lg"
+ style={{width: '100%'}}
+ onClick={() => {
+ setUseTarget(previewTarget);
+ setPreviewTarget(null);
+ setPanelTab('configure');
+ setChatOpen(true);
+ }}
+ />
+ <div style={{display: 'flex', gap: 8}} ref={card4AddPopoverRef}>
<XDSButton
- variant="primary"
- label="Start crafting"
+ ref={card4AddButtonRef}
+ variant="secondary"
+ label="Use in your product"
size="lg"
style={{flex: 1}}
onClick={() => {
- setUseTarget(previewTarget);
- setPreviewTarget(null);
- setPanelTab('configure');
- setChatOpen(true);
+ if (card4AddButtonRef.current) {
+ const rect = card4AddButtonRef.current.getBoundingClientRect();
+ setCard4AddPopoverPos({top: rect.bottom + 8, left: rect.left});
+ }
+ setCard4ShowAddPopover(prev => !prev);
}}
/>
<XDSTooltip content="Bookmark">
@@ -690,22 +716,6 @@ function DocsiteLandingTemplate() {
onClick={() => setCard4Bookmarked(prev => !prev)}
/>
</XDSTooltip>
- </div>
- <div ref={card4AddPopoverRef}>
- <XDSButton
- ref={card4AddButtonRef}
- variant="secondary"
- label="Use in your product"
- size="lg"
- style={{width: '100%'}}
- onClick={() => {
- if (card4AddButtonRef.current) {
- const rect = card4AddButtonRef.current.getBoundingClientRect();
- setCard4AddPopoverPos({top: rect.bottom + 8, left: rect.left});
- }
- setCard4ShowAddPopover(prev => !prev);
- }}
- />
{card4ShowAddPopover && card4AddPopoverPos && (
<SharePopover
cliCommand={`npx xds template ${t.name.toLowerCase().replace(/\s+/g, '-')} ./my-project`}
@@ -717,12 +727,112 @@ function DocsiteLandingTemplate() {
</div>
{/* Themes — pinned grid */}
- <div style={{marginTop: 32}}>
+ <div style={{marginTop: 24}}>
<div style={{display: 'flex', alignItems: 'center', justifyContent: 'space-between'}}>
<XDSText type="body" style={{fontWeight: 600}}>Apply your themes</XDSText>
- <XDSButton variant="ghost" size="sm" label="Browse" onClick={() => setCard4ThemeBrowse(true)} />
+ <XDSPopover
+ label="Browse themes"
+ placement="below"
+ alignment="end"
+ width={480}
+ isOpen={card4ThemeBrowse}
+ 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'}} />
+ <XDSTextInput
+ label="Search"
+ isLabelHidden
+ placeholder="Search themes..."
+ value={card4ThemeSearch}
+ onChange={setCard4ThemeSearch}
+ 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
+ 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}} />
+ );
+ })()}
+ <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>
+ }>
+ <button
+ role="button"
+ style={{
+ background: 'none',
+ border: 'none',
+ padding: 0,
+ cursor: 'pointer',
+ font: 'inherit',
+ }}>
+ <XDSText type="supporting" color="secondary">Browse</XDSText>
+ </button>
+ </XDSPopover>
</div>
- <div style={{display: 'grid', gridTemplateColumns: 'repeat(auto-fill, 44px)', gap: 8, marginTop: 12}}>
+ <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];
@@ -733,7 +843,7 @@ function DocsiteLandingTemplate() {
style={{
width: 44, height: 44, borderRadius: 10,
display: 'flex', alignItems: 'center', justifyContent: 'center', cursor: 'pointer',
- border: isSelected ? '2px solid var(--color-accent)' : '2px solid var(--color-border-emphasized)',
+ border: isSelected ? '1.5px solid var(--color-accent)' : '1px solid var(--color-border-emphasized)',
backgroundColor: '#fff',
transition: 'border-color 0.15s ease',
}}>
@@ -747,110 +857,13 @@ function DocsiteLandingTemplate() {
);
})}
</div>
-
- {/* Theme browse dialog */}
- <XDSDialog
- isOpen={card4ThemeBrowse}
- onOpenChange={open => { setCard4ThemeBrowse(open); if (!open) setCard4ThemeSearch(''); }}
- width={720}>
- <XDSDialogHeader
- title="All Themes"
- onOpenChange={open => { setCard4ThemeBrowse(open); if (!open) setCard4ThemeSearch(''); }}
- />
- <div style={{display: 'flex', flexDirection: 'column', gap: 16, padding: 16}}>
- <XDSTextInput
- label="Search"
- isLabelHidden
- placeholder="Search themes..."
- value={card4ThemeSearch}
- onChange={setCard4ThemeSearch}
- 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(
- e => e.category === category && e.name.toLowerCase().includes(card4ThemeSearch.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 = 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 ? '2px solid var(--color-accent)' : '2px solid var(--color-border-emphasized)',
- transition: 'border-color 0.15s ease',
- }}>
- <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}} />
- );
- })()}
- <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>
- </XDSDialog>
- </div>
-
- {/* Component used */}
- <div style={{marginTop: 32}}>
- <XDSText type="body" style={{fontWeight: 600}}>Component used</XDSText>
- <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>
{/* More like this */}
- <div style={{padding: '16px 32px 0'}}>
+ <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) => (
@@ -869,7 +882,7 @@ function DocsiteLandingTemplate() {
</div>
{/* Explore more */}
- <div style={{padding: '32px 32px 40px'}}>
+ <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 => (
@@ -877,6 +890,16 @@ function DocsiteLandingTemplate() {
))}
</div>
</div>
+
+ {/* 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>
+ </div>
</div>
</div>
</>
diff --git a/apps/sandbox/src/app/layout.tsx b/apps/sandbox/src/app/layout.tsx
index 030ff30cda..e6b44b2364 100644
--- a/apps/sandbox/src/app/layout.tsx
+++ b/apps/sandbox/src/app/layout.tsx
@@ -10,7 +10,6 @@ import type {Metadata} from 'next';
* 4. @xds/theme-neutral/theme.css → @layer xds-theme (neutral theme)
* 5. @xds/theme-brutalist/theme.css → @layer xds-theme (brutalist theme)
* 6. @xds/theme-meta/theme.css → @layer xds-theme (meta theme)
- * 7. @xds/theme-daily/theme.css → @layer xds-theme (daily theme)
*
* All theme CSS files are in @layer xds-theme and scoped via
* @scope ([data-xds-theme="name"]), so only the active theme's rules apply.
@@ -24,7 +23,6 @@ import '@xds/theme-default/theme.css';
import '@xds/theme-neutral/theme.css';
import '@xds/theme-brutalist/theme.css';
import '@xds/theme-meta/theme.css';
-import '@xds/theme-daily/theme.css';
import './globals.css';
import {Providers} from './providers';
diff --git a/apps/sandbox/src/app/providers.tsx b/apps/sandbox/src/app/providers.tsx
index 3a14aaec2f..fb0b7d15e4 100644
--- a/apps/sandbox/src/app/providers.tsx
+++ b/apps/sandbox/src/app/providers.tsx
@@ -7,7 +7,6 @@ import {neutralTheme} from '@xds/theme-neutral/built';
import {brutalistTheme} from '@xds/theme-brutalist/built';
import {metaTheme} from '@xds/theme-meta/built';
import {whatsappTheme} from '@xds/theme-whatsapp/built';
-import {dailyTheme} from '@xds/theme-daily/built';
import type {XDSDefinedTheme, ThemeMode} from '@xds/core/theme';
const themes: Record<string, XDSDefinedTheme> = {
@@ -16,7 +15,6 @@ const themes: Record<string, XDSDefinedTheme> = {
brutalist: brutalistTheme,
meta: metaTheme,
whatsapp: whatsappTheme,
- daily: dailyTheme,
};
type ThemeContextValue = {