From b2e4ae2828455a578248909127817c6340be694d Mon Sep 17 00:00:00 2001 From: "xuan.huang" <5563315+Huxpro@users.noreply.github.com> Date: Mon, 4 May 2026 01:36:27 +0200 Subject: [PATCH 1/2] feat(a2ui-playground): add theme toggle, phone/full preview mode, and UI polish - Set page title to "Lynx A2UI Playground" (html.title + header brand) - Add dark/light mode toggle in the header - Simplify phone frame: clean bezel with border, no notch/status bar - Add Phone/Full preview mode toggle in the preview panel header - Fix preview header layout to handle chips + toggle without cramping --- .../genui/a2ui-playground/rsbuild.config.ts | 3 + packages/genui/a2ui-playground/src/App.tsx | 25 ++- .../src/components/MobilePreview.tsx | 10 +- .../a2ui-playground/src/pages/DemosPage.tsx | 41 ++++- packages/genui/a2ui-playground/src/styles.css | 152 ++++++++++-------- 5 files changed, 154 insertions(+), 77 deletions(-) diff --git a/packages/genui/a2ui-playground/rsbuild.config.ts b/packages/genui/a2ui-playground/rsbuild.config.ts index b36415e8a6..2c1e1ef837 100644 --- a/packages/genui/a2ui-playground/rsbuild.config.ts +++ b/packages/genui/a2ui-playground/rsbuild.config.ts @@ -43,6 +43,9 @@ export default defineConfig({ render: './src/render.tsx', }, }, + html: { + title: 'Lynx A2UI Playground', + }, output: { assetPrefix: process.env.ASSET_PREFIX, copy: [ diff --git a/packages/genui/a2ui-playground/src/App.tsx b/packages/genui/a2ui-playground/src/App.tsx index a17502a822..8a7164be68 100644 --- a/packages/genui/a2ui-playground/src/App.tsx +++ b/packages/genui/a2ui-playground/src/App.tsx @@ -33,11 +33,24 @@ function parseHash(hash: string): Route { return { tab: 'chat' }; } +type Theme = 'light' | 'dark'; + +function getSystemTheme(): Theme { + return window.matchMedia('(prefers-color-scheme: dark)').matches + ? 'dark' + : 'light'; +} + export function App() { const [route, setRoute] = useState(() => parseHash(window.location.hash) ); const [protocol, setProtocol] = useState(DEFAULT_PROTOCOL); + const [theme, setTheme] = useState(getSystemTheme); + + useEffect(() => { + document.documentElement.setAttribute('data-theme', theme); + }, [theme]); useEffect(() => { const onHashChange = () => { @@ -71,7 +84,7 @@ export function App() { return (
- A2UI Playground + Lynx A2UI Playground
+ +
diff --git a/packages/genui/a2ui-playground/src/components/MobilePreview.tsx b/packages/genui/a2ui-playground/src/components/MobilePreview.tsx index 6b040ef1f4..2abb8849f4 100644 --- a/packages/genui/a2ui-playground/src/components/MobilePreview.tsx +++ b/packages/genui/a2ui-playground/src/components/MobilePreview.tsx @@ -5,15 +5,7 @@ export function MobilePreview(props: { src: string }) { return (
-
-
-
-
-