Skip to content

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

TypeScript

fix(docsite): Playground restyling with nav and sections (#2546)

Kenton Quatman078947d0ca83
diff --git a/apps/docsite/src/app/(preview)/playground-preview/page.tsx b/apps/docsite/src/app/(preview)/playground-preview/page.tsx
index baa2061390..b0105e9b3d 100644
--- a/apps/docsite/src/app/(preview)/playground-preview/page.tsx
+++ b/apps/docsite/src/app/(preview)/playground-preview/page.tsx
@@ -239,7 +239,10 @@ function createTargetingController(
if (sep < 0) {
return null;
}
- return {component: id.slice(0, sep), index: parseInt(id.slice(sep + 1), 10)};
+ return {
+ component: id.slice(0, sep),
+ index: parseInt(id.slice(sep + 1), 10),
+ };
}
function positionOverlay(target: HTMLElement) {
@@ -428,7 +431,9 @@ export default function PreviewPage() {
window.parent.postMessage(msg, '*');
}, []);
- const targetingRef = useRef<ReturnType<typeof createTargetingController> | null>(null);
+ const targetingRef = useRef<ReturnType<
+ typeof createTargetingController
+ > | null>(null);
if (targetingRef.current == null && typeof window !== 'undefined') {
targetingRef.current = createTargetingController(postToParent);
}
@@ -548,7 +553,7 @@ export default function PreviewPage() {
? {
minHeight: '100%',
display: 'block',
- backgroundColor: 'var(--color-background-body)',
+ backgroundColor: 'var(--color-background-surface)',
}
: {
minHeight: '100%',
@@ -557,7 +562,7 @@ export default function PreviewPage() {
justifyContent: 'center',
padding: 'var(--spacing-4, 16px)',
boxSizing: 'border-box',
- backgroundColor: 'var(--color-background-body)',
+ backgroundColor: 'var(--color-background-surface)',
};
// In fill mode the wrapper has no box (display: contents) so the rendered
diff --git a/apps/docsite/src/app/playground/CraftPanel.tsx b/apps/docsite/src/app/playground/CraftPanel.tsx
deleted file mode 100644
index c5201a669c..0000000000
--- a/apps/docsite/src/app/playground/CraftPanel.tsx
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright (c) Meta Platforms, Inc. and affiliates.
-
-/**
- * @file CraftPanel.tsx
- * @output Disabled AI "Craft" chat with a coming-soon empty state
- * @position Playground left panel — "Craft" tab (placeholder for future AI).
- */
-
-'use client';
-
-import * as stylex from '@stylexjs/stylex';
-import {XDSChatMessageList, XDSChatComposer} from '@xds/core/Chat';
-import {XDSEmptyState} from '@xds/core/EmptyState';
-import {Sparkles} from 'lucide-react';
-
-const s = stylex.create({
- root: {
- display: 'flex',
- flexDirection: 'column',
- height: '100%',
- minHeight: 0,
- overflow: 'hidden',
- },
- list: {
- flex: 1,
- minHeight: 0,
- overflow: 'auto',
- },
- composer: {
- flexShrink: 0,
- padding: 'var(--spacing-3)',
- },
- icon: {
- transform: 'scale(2)',
- display: 'inline-flex',
- color: 'var(--color-text-secondary)',
- paddingBottom: 'var(--spacing-1)',
- },
-});
-
-export function CraftPanel() {
- return (
- <div {...stylex.props(s.root)}>
- <XDSChatMessageList
- density="compact"
- xstyle={s.list}
- emptyState={
- <XDSEmptyState
- icon={
- <span aria-hidden="true" {...stylex.props(s.icon)}>
- <Sparkles size={24} />
- </span>
- }
- title="Craft with AI"
- description="This feature is coming later."
- headingLevel={3}
- />
- }>
- {[]}
- </XDSChatMessageList>
- <div {...stylex.props(s.composer)}>
- <XDSChatComposer
- isDisabled
- value=""
- onChange={() => {}}
- onSubmit={() => {}}
- placeholder="Coming soon…"
- />
- </div>
- </div>
- );
-}
diff --git a/apps/docsite/src/app/playground/PlaygroundClient.tsx b/apps/docsite/src/app/playground/PlaygroundClient.tsx
index 14bd851be3..f83b88683d 100644
--- a/apps/docsite/src/app/playground/PlaygroundClient.tsx
+++ b/apps/docsite/src/app/playground/PlaygroundClient.tsx
@@ -6,12 +6,13 @@
* @output Full-page two-panel playground (editor + live preview)
* @position app/playground — the interactive XDS code playground.
*
- * Left panel: back + tabs (Code · Property · Craft).
+ * Sidebar: icon-only nav strip — back, Code view, Properties view.
+ * Left panel: Monaco editor (Code) or knobs (Properties).
* - Code: Monaco editor (controlled) with real XDS .d.ts typedefs.
* - Property: component selector + instance picker + knobs that edit the code.
- * - Craft: disabled AI chat placeholder.
- * Right panel: toolbar (theme + dark mode · viewport segmented control ·
- * expand · reset · share) over a responsive /playground-preview iframe.
+ * Right panel: toolbar (dark mode · target element · viewport
+ * segmented control · share · expand) over a responsive
+ * /playground-preview iframe.
*
* The preview iframe is driven via postMessage (preview-code / preview-theme);
* code lives in React state and is the single source of truth shared by Monaco,
@@ -23,28 +24,27 @@
import {useCallback, useEffect, useMemo, useRef, useState} from 'react';
import dynamic from 'next/dynamic';
import {loader} from '@monaco-editor/react';
-import {useRouter} from 'next/navigation';
import * as stylex from '@stylexjs/stylex';
import {
compressToEncodedURIComponent,
decompressFromEncodedURIComponent,
} from 'lz-string';
import {XDSButton} from '@xds/core/Button';
-import {XDSSelector} from '@xds/core/Selector';
-import {XDSHStack} from '@xds/core/Layout';
-import {XDSText} from '@xds/core/Text';
+import {XDSLink} from '@xds/core/Link';
+import {XDSHStack, XDSVStack} from '@xds/core/Layout';
+import {XDSText, XDSHeading} from '@xds/core/Text';
import {XDSStatusDot} from '@xds/core/StatusDot';
import {XDSToolbar} from '@xds/core/Toolbar';
-import {XDSTabList, XDSTab} from '@xds/core/TabList';
import {
XDSSegmentedControl,
XDSSegmentedControlItem,
} from '@xds/core/SegmentedControl';
import {useXDSResizable, XDSResizeHandle} from '@xds/core/Resizable';
-import {XDSToggleButton} from '@xds/core/ToggleButton';
+import {XDSToggleButton, XDSToggleButtonGroup} from '@xds/core/ToggleButton';
import {
- ArrowLeft,
+ Code2,
Moon,
+ SlidersHorizontal,
Sun,
Monitor,
Smartphone,
@@ -55,11 +55,9 @@ import {
import githubLight from './themes/github-light.json';
import githubDark from './themes/github-dark.json';
import {useThemeMode} from '../providers';
-import {
- PLAYGROUND_THEME_OPTIONS,
- DEFAULT_PLAYGROUND_THEME,
-} from './playgroundThemes';
+import {DEFAULT_PLAYGROUND_THEME} from './playgroundThemes';
import {PreviewStage, type Viewport} from './PreviewStage';
+import {BRAND_ICON} from '../../components/XDSWordmark';
import {PropertyPanel} from './PropertyPanel';
import {annotateInstanceIds} from './babelParser';
@@ -289,7 +287,7 @@ function configureMonaco(monaco: MonacoInstance) {
});
}
-type LeftTab = 'code' | 'property' | 'craft';
+type LeftView = 'code' | 'property';
type BuildStatus = 'idle' | 'building' | 'finished' | 'error';
const BUILD_STATUS_META: Record<
@@ -302,25 +300,34 @@ const BUILD_STATUS_META: Record<
};
const s = stylex.create({
+ hidden: {
+ display: 'none',
+ },
+ navGroup: {
+ gap: 'var(--spacing-2)',
+ },
root: {
- display: 'flex',
- height: '100%',
+ flex: 1,
+ minWidth: 0,
overflow: 'hidden',
backgroundColor: 'var(--color-background-surface)',
},
+ sidebar: {
+ flexShrink: 0,
+ backgroundColor: 'var(--color-background-surface)',
+ borderInlineEndWidth: '1px',
+ borderInlineEndStyle: 'solid',
+ borderInlineEndColor: 'var(--color-border)',
+ padding: 'var(--spacing-3)',
+ },
leftPanel: {
flexShrink: 0,
- display: 'flex',
- flexDirection: 'column',
overflow: 'hidden',
minWidth: 0,
},
- panelHeader: {
+ leftPanelHeader: {
flexShrink: 0,
- padding: 'var(--spacing-2) var(--spacing-2) 0',
- },
- tabStretch: {
- flex: 1,
+ padding: 'var(--spacing-3)',
},
tabBody: {
flex: 1,
@@ -333,17 +340,12 @@ const s = stylex.create({
flex: 1,
minHeight: 0,
minWidth: 0,
- marginBlockStart: 'var(--spacing-1)',
- },
- hidden: {
- display: 'none',
},
rightPanel: {
flex: 1,
- display: 'flex',
- flexDirection: 'column',
minWidth: 0,
overflow: 'hidden',
+ backgroundColor: 'var(--color-background-muted)',
},
buildStatus: {
display: 'flex',
@@ -356,15 +358,14 @@ const s = stylex.create({
});
export function PlaygroundClient() {
- const router = useRouter();
// The editor chrome follows the docsite's own light/dark mode, not the OS
// (operator) color-scheme preference.
const {mode: siteMode} = useThemeMode();
const editorTheme = siteMode === 'dark' ? 'github-dark' : 'github-light';
const [code, setCode] = useState(getInitialCode);
- const [theme, setTheme] = useState(DEFAULT_PLAYGROUND_THEME);
const [mode, setMode] = useState<'light' | 'dark'>('light');
- const [activeTab, setActiveTab] = useState<LeftTab>('code');
+ const theme = DEFAULT_PLAYGROUND_THEME;
+ const [activeView, setActiveView] = useState<LeftView>('code');
const [viewport, setViewport] = useState<Viewport>('desktop');
const [isFullscreen, setIsFullscreen] = useState(false);
const [isResizing, setIsResizing] = useState(false);
@@ -373,12 +374,11 @@ export function PlaygroundClient() {
const [copied, setCopied] = useState(false);
const [previewReady, setPreviewReady] = useState(false);
const [isTargeting, setIsTargeting] = useState(false);
- const [targetedComponent, setTargetedComponent] = useState<string | null>(null);
+ const [targetedComponent, setTargetedComponent] = useState<string | null>(
+ null,
+ );
const [targetedInstance, setTargetedInstance] = useState(0);
- // The code the playground was seeded with (a shared/example snippet from the
- // URL hash, or the default). Reset restores this — not the hardcoded default.
- const seedCodeRef = useRef(code);
const iframeRef = useRef<HTMLIFrameElement>(null);
const readyRef = useRef(false);
const pendingRef = useRef<string | null>(null);
@@ -386,10 +386,10 @@ export function PlaygroundClient() {
const editorRef = useRef<MonacoTypes.editor.IStandaloneCodeEditor | null>(
null,
);
- // Mirror activeTab in a ref so onMount can read the current tab without
+ // Mirror activeView in a ref so onMount can read the current view without
// re-creating the (stable) mount callback.
- const activeTabRef = useRef(activeTab);
- activeTabRef.current = activeTab;
+ const activeViewRef = useRef(activeView);
+ activeViewRef.current = activeView;
const editorPanel = useXDSResizable({
defaultSize: 440,
@@ -413,8 +413,6 @@ export function PlaygroundClient() {
const onHashChange = () => {
const newCode = getInitialCode();
if (newCode !== DEFAULT_CODE) {
- // A new shared/example snippet became the seed — Reset targets it.
- seedCodeRef.current = newCode;
setCode(newCode);
}
};
@@ -481,7 +479,7 @@ export function PlaygroundClient() {
if (e.data?.type === 'targeting-select') {
setTargetedComponent(e.data.component);
setTargetedInstance(e.data.index);
- setActiveTab('property');
+ setActiveView('property');
setIsTargeting(false);
iframeRef.current?.contentWindow?.postMessage(
{type: 'targeting-disable'},
@@ -541,7 +539,7 @@ export function PlaygroundClient() {
{type: 'preview-theme', theme, mode},
window.location.origin,
);
- }, [theme, mode, previewReady]);
+ }, [mode, previewReady]);
// While the resize handle is dragged, the cursor can pass over the preview
// iframe — a separate document that swallows pointer events and stalls the
@@ -613,28 +611,28 @@ export function PlaygroundClient() {
) => {
editorRef.current = editor;
configureMonaco(monaco);
- // Focus on initial mount if the Code tab is the active one.
- if (activeTabRef.current === 'code') {
+ // Focus on initial mount if the Code view is the active one.
+ if (activeViewRef.current === 'code') {
editor.focus();
}
},
[],
);
- // Focus the editor (blinking cursor) whenever the Code tab becomes active.
+ // Focus the editor (blinking cursor) whenever the Code view becomes active.
useEffect(() => {
- if (activeTab !== 'code') {
+ if (activeView !== 'code') {
return;
}
const id = requestAnimationFrame(() => editorRef.current?.focus());
return () => cancelAnimationFrame(id);
- }, [activeTab]);
+ }, [activeView]);
- // Jump to a specific source offset in the editor (used by the Property tab's
- // "set in code" links). Switches to the Code tab, then reveals + selects the
+ // Jump to a specific source offset in the editor (used by the Property view's
+ // "set in code" links). Switches to the Code view, then reveals + selects the
// position once Monaco is visible.
const revealInCode = useCallback((offset: number) => {
- setActiveTab('code');
+ setActiveView('code');
requestAnimationFrame(() => {
const editor = editorRef.current;
const model = editor?.getModel();
@@ -676,183 +674,204 @@ export function PlaygroundClient() {
);
return (
- <div {...stylex.props(s.root)} onPointerDownCapture={handleResizeProbe}>
- {/* Left panel — editor */}
- <div
- {...stylex.props(s.leftPanel)}
- style={{width: editorPanel.size || 440}}>
- <XDSHStack gap={2} vAlign="center" xstyle={s.panelHeader}>
- <XDSButton
- label="Back"
- tooltip="Back"
- variant="ghost"
- size="md"
+ <XDSHStack align="stretch" height="100%" width="100%">
+ {/* Playground navigation */}
+ <XDSVStack align="center" xstyle={s.sidebar} gap={4}>
+ <XDSLink href="/" label="Go to home">
+ {BRAND_ICON}
+ </XDSLink>
+ <XDSToggleButtonGroup
+ type="single"
+ orientation="vertical"
+ label="Playground view"
+ value={activeView}
+ // Single-select groups allow deselecting to null; guard against it so
+ // one view is always active.
+ onChange={v => v && setActiveView(v as LeftView)}
+ size="md"
+ xstyle={s.navGroup}>
+ <XDSToggleButton
+ value="code"
+ label="Code"
+ tooltip="Code"
isIconOnly
- icon={<ArrowLeft size={20} />}
- onClick={() => router.back()}
+ icon={<Code2 size={20} />}
/>
- <XDSTabList
- value={activeTab}
- onChange={v => setActiveTab(v as LeftTab)}
- size="md"
- xstyle={s.tabStretch}>
- <XDSTab value="code" label="Code" xstyle={s.tabStretch} />
- <XDSTab value="property" label="Properties" xstyle={s.tabStretch} />
- </XDSTabList>
- </XDSHStack>
+ <XDSToggleButton
+ value="property"
+ label="Properties"
+ tooltip="Properties"
+ isIconOnly
+ icon={<SlidersHorizontal size={20} />}
+ />
+ </XDSToggleButtonGroup>
+ </XDSVStack>
- <div {...stylex.props(s.tabBody)}>
- {/* Code: Monaco stays mounted to preserve typedefs + editor state */}
- <div {...stylex.props(s.codePane, activeTab !== 'code' && s.hidden)}>
- <MonacoEditor
- defaultLanguage="typescript"
- value={code}
- path="playground.tsx"
- theme={editorTheme}
- onChange={v => setCode(v ?? '')}
- beforeMount={handleMonacoBeforeMount}
- onMount={handleMonacoMount}
- options={editorOptions}
- />
+ {/* Playground content */}
+ <XDSHStack
+ height="100%"
+ xstyle={s.root}
+ onPointerDownCapture={handleResizeProbe}>
+ {/* Left panel — editor */}
+ <XDSVStack xstyle={s.leftPanel} width={editorPanel.size || 440}>
+ <div {...stylex.props(s.leftPanelHeader)}>
+ <XDSHeading level={3}>Playground</XDSHeading>
</div>
-
- {activeTab === 'property' && (
- <PropertyPanel
- code={code}
- onCodeChange={setCode}
- onRevealInCode={revealInCode}
- onFlashInstance={selectInstance}
- externalSelection={targetedComponent != null ? {
- component: targetedComponent,
- instanceIndex: targetedInstance,
- } : undefined}
- onExternalSelectionConsumed={() => {
- setTargetedComponent(null);
- }}
- />
- )}
- </div>
- </div>
-
- <XDSResizeHandle
- label="Resize editor panel"
- resizable={editorPanel.props}
- pillPlacement="center"
- />
-
- {/* Right panel — preview */}
- <div {...stylex.props(s.rightPanel)}>
- <XDSToolbar
- label="Preview controls"
- startContent={
- <XDSHStack gap={2} vAlign="center">
- <XDSSelector
- label="Theme"
- isLabelHidden
- options={PLAYGROUND_THEME_OPTIONS}
- value={theme}
- onChange={setTheme}
- size="md"
+ <div {...stylex.props(s.tabBody)}>
+ {/* Code: Monaco stays mounted to preserve typedefs + editor state */}
+ <div
+ {...stylex.props(s.codePane, activeView !== 'code' && s.hidden)}>
+ <MonacoEditor
+ defaultLanguage="typescript"
+ value={code}
+ path="playground.tsx"
+ theme={editorTheme}
+ onChange={v => setCode(v ?? '')}
+ beforeMount={handleMonacoBeforeMount}
+ onMount={handleMonacoMount}
+ options={editorOptions}
/>
- <XDSButton
- label={mode === 'light' ? 'Switch to dark' : 'Switch to light'}
- tooltip={mode === 'light' ? 'Dark mode' : 'Light mode'}
- variant="ghost"
- size="md"
- isIconOnly
- icon={mode === 'light' ? <Moon size={20} /> : <Sun size={20} />}
- onClick={() => setMode(m => (m === 'light' ? 'dark' : 'light'))}
+ </div>
+
+ {activeView === 'property' && (
+ <PropertyPanel
+ code={code}
+ onCodeChange={setCode}
+ onRevealInCode={revealInCode}
+ onFlashInstance={selectInstance}
+ externalSelection={
+ targetedComponent != null
+ ? {
+ component: targetedComponent,
+ instanceIndex: targetedInstance,
+ }
+ : undefined
+ }
+ onExternalSelectionConsumed={() => {
+ setTargetedComponent(null);
+ }}
/>
+ )}
+ </div>
+ </XDSVStack>
+
+ <XDSResizeHandle
+ label="Resize editor panel"
+ resizable={editorPanel.props}
+ pillPlacement="center"
+ hasDivider
+ />
+
+ {/* Right panel — preview */}
+ <XDSVStack xstyle={s.rightPanel}>
+ <XDSToolbar
+ label="Preview controls"
+ startContent={
<XDSToggleButton
label="Target element"
- tooltip={isTargeting ? 'Exit targeting (Esc)' : 'Click to select an element'}
+ tooltip={
+ isTargeting
+ ? 'Exit targeting (Esc)'
+ : 'Click to select an element'
+ }
isPressed={isTargeting}
onPressedChange={toggleTargeting}
size="md"
isIconOnly
icon={<Crosshair size={20} />}
/>
- </XDSHStack>
- }
- centerContent={
- <XDSSegmentedControl
- label="Viewport size"
- size="md"
- value={viewport}
- onChange={v => setViewport(v as Viewport)}>
- <XDSSegmentedControlItem
- value="desktop"
- label="Desktop"
- isLabelHidden
- icon={<Monitor size={20} />}
- />
- <XDSSegmentedControlItem
- value="phone"
- label="Phone"
- isLabelHidden
- icon={<Smartphone size={20} />}
- />
- </XDSSegmentedControl>
- }
- endContent={
- <XDSHStack gap={2} vAlign="center">
- {buildStatus !== 'idle' && (
- <div
- {...stylex.props(s.buildStatus)}
- style={{opacity: statusFading ? 0 : 1}}>
- <XDSStatusDot
- variant={BUILD_STATUS_META[buildStatus].variant}
- label={BUILD_STATUS_META[buildStatus].label}
- isPulsing={buildStatus === 'building'}
+ }
+ centerContent={
+ <XDSHStack gap={2} vAlign="center">
+ <XDSButton
+ label={
+ mode === 'light' ? 'Switch to dark' : 'Switch to light'
+ }
+ tooltip={mode === 'light' ? 'Dark mode' : 'Light mode'}
+ variant="ghost"
+ size="md"
+ isIconOnly
+ icon={
+ mode === 'light' ? <Moon size={20} /> : <Sun size={20} />
+ }
+ onClick={() =>
+ setMode(m => (m === 'light' ? 'dark' : 'light'))
+ }
+ />
+ <XDSSegmentedControl
+ label="Viewport size"
+ size="md"
+ value={viewport}
+ onChange={v => setViewport(v as Viewport)}>
+ <XDSSegmentedControlItem
+ value="desktop"
+ label="Desktop"
+ isLabelHidden
+ icon={<Monitor size={20} />}
+ />
+ <XDSSegmentedControlItem
+ value="phone"
+ label="Phone"
+ isLabelHidden
+ icon={<Smartphone size={20} />}
/>
- <XDSText type="supporting" color="secondary">
- {BUILD_STATUS_META[buildStatus].label}
- </XDSText>
- {buildStatus === 'error' && (
- <XDSButton
- label="Rebuild"
- tooltip="Rebuild"
- variant="ghost"
- size="sm"
- isIconOnly
- icon={<RotateCw size={16} />}
- onClick={handleRebuild}
+ </XDSSegmentedControl>
+ <XDSButton
+ label="Expand"
+ tooltip="Fullscreen preview"
+ variant="ghost"
+ size="md"
+ isIconOnly
+ icon={<Maximize2 size={20} />}
+ onClick={() => setIsFullscreen(true)}
+ />
+ </XDSHStack>
+ }
+ endContent={
+ <XDSHStack gap={4} vAlign="center">
+ {buildStatus !== 'idle' && (
+ <div
+ {...stylex.props(s.buildStatus)}
+ style={{opacity: statusFading ? 0 : 1}}>
+ <XDSStatusDot
+ variant={BUILD_STATUS_META[buildStatus].variant}
+ label={BUILD_STATUS_META[buildStatus].label}
+ isPulsing={buildStatus === 'building'}
/>
- )}
- </div>
- )}
- <XDSButton
- label="Expand"
- tooltip="Fullscreen preview"
- variant="ghost"
- size="md"
- isIconOnly
- icon={<Maximize2 size={20} />}
- onClick={() => setIsFullscreen(true)}
- />
- <XDSButton
- label="Reset"
- variant="ghost"
- size="md"
- onClick={() => setCode(seedCodeRef.current)}
- />
- <XDSButton
- label={copied ? '✓ Copied' : 'Share'}
- variant={copied ? 'primary' : 'secondary'}
- size="md"
- onClick={handleShare}
- />
- </XDSHStack>
- }
- />
- <PreviewStage
- viewport={viewport}
- isFullscreen={isFullscreen}
- onExitFullscreen={() => setIsFullscreen(false)}
- iframeRef={iframeRef}
- isInteractionDisabled={isResizing}
- />
- </div>
- </div>
+ <XDSText type="supporting" color="secondary">
+ {BUILD_STATUS_META[buildStatus].label}
+ </XDSText>
+ {buildStatus === 'error' && (
+ <XDSButton
+ label="Rebuild"
+ tooltip="Rebuild"
+ variant="ghost"
+ size="sm"
+ isIconOnly
+ icon={<RotateCw size={16} />}
+ onClick={handleRebuild}
+ />
+ )}
+ </div>
+ )}
+ <XDSButton
+ label={copied ? '✓ Copied' : 'Share'}
+ variant="primary"
+ size="md"
+ onClick={handleShare}
+ />
+ </XDSHStack>
+ }
+ />
+ <PreviewStage
+ viewport={viewport}
+ isFullscreen={isFullscreen}
+ onExitFullscreen={() => setIsFullscreen(false)}
+ iframeRef={iframeRef}
+ isInteractionDisabled={isResizing}
+ />
+ </XDSVStack>
+ </XDSHStack>
+ </XDSHStack>
);
}
diff --git a/apps/docsite/src/app/playground/PreviewStage.tsx b/apps/docsite/src/app/playground/PreviewStage.tsx
index 974af09b5a..b2734ca3c1 100644
--- a/apps/docsite/src/app/playground/PreviewStage.tsx
+++ b/apps/docsite/src/app/playground/PreviewStage.tsx
@@ -37,7 +37,6 @@ const s = stylex.create({
paddingInline: 'var(--spacing-4)',
paddingBlockEnd: 'var(--spacing-4)',
paddingBlockStart: 0,
- backgroundColor: 'var(--color-background-surface)',
},
areaCenter: {
alignItems: 'center',
@@ -46,7 +45,8 @@ const s = stylex.create({
position: 'fixed',
inset: 0,
zIndex: 50,
- padding: 0,
+ paddingInline: 0,
+ paddingBlockEnd: 0,
},
// In fullscreen the card chrome (radius, border, shadow) is stripped so the
// preview reads as a bare, edge-to-edge surface. The element stays mounted to
@@ -64,7 +64,6 @@ const s = stylex.create({
transitionDuration: 'var(--duration-medium, 410ms)',
transitionTimingFunction:
'var(--ease-standard, cubic-bezier(0.24, 1, 0.4, 1))',
- boxShadow: 'var(--shadow-med)',
},
iframe: {
border: 'none',
@@ -80,11 +79,12 @@ const s = stylex.create({
iframeInert: {
pointerEvents: 'none',
},
- exitButton: {
+ exitButtonCard: {
position: 'absolute',
top: 'var(--spacing-4)',
right: 'var(--spacing-4)',
zIndex: 51,
+ boxShadow: 'var(--shadow-med)',
},
});
@@ -116,19 +116,17 @@ export function PreviewStage({
isFullscreen && s.fullscreen,
)}>
{isFullscreen && (
- <div {...stylex.props(s.exitButton)}>
- <XDSCard padding={0} style={{boxShadow: 'var(--shadow-med)'}}>
- <XDSButton
- label="Exit fullscreen"
- tooltip="Exit fullscreen"
- variant="ghost"
- size="sm"
- isIconOnly
- icon={<Minimize2 size={16} />}
- onClick={onExitFullscreen}
- />
- </XDSCard>
- </div>
+ <XDSCard padding={0} xstyle={s.exitButtonCard}>
+ <XDSButton
+ label="Exit fullscreen"
+ tooltip="Exit fullscreen"
+ variant="ghost"
+ size="sm"
+ isIconOnly
+ icon={<Minimize2 size={16} />}
+ onClick={onExitFullscreen}
+ />
+ </XDSCard>
)}
<XDSCard
padding={0}