diff --git a/packages/www/src/global.d.ts b/packages/www/src/global.d.ts deleted file mode 100644 index 6aef027fd..000000000 --- a/packages/www/src/global.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -declare namespace JSX { - interface IntrinsicElements { - 'sp-split-view': React.DetailedHTMLProps< - React.HTMLAttributes, - HTMLElement - >; - } -} diff --git a/packages/www/src/web-components/play-ground.tsx b/packages/www/src/web-components/play-ground.tsx index 02a40571b..a5e2a0fd1 100644 --- a/packages/www/src/web-components/play-ground.tsx +++ b/packages/www/src/web-components/play-ground.tsx @@ -8,6 +8,11 @@ export default async function PlayGround( const code = state(''); const preview: HTMLIFrameElement = self.querySelector('#preview-iframe')!; const activeTab = state('tab-wc'); + const isMobileLayout = state(false); + + function updateSplitViewOrientation() { + isMobileLayout.value = window.innerWidth <= 968; + } function onReceiveCompiledCode(e: MessageEvent) { if (e.data.source !== 'brisa-playground-preview') return; @@ -22,11 +27,16 @@ export default async function PlayGround( } onMount(() => { + // Set initial layout based on screen size + updateSplitViewOrientation(); + window.addEventListener('message', onReceiveCompiledCode); + window.addEventListener('resize', updateSplitViewOrientation); }); cleanup(() => { window.removeEventListener('message', onReceiveCompiledCode); + window.removeEventListener('resize', updateSplitViewOrientation); }); css` @@ -99,20 +109,75 @@ export default async function PlayGround( .original-code { width: 100%; - height: 100%; } .output { width: 100%; + height: 100%; } } `; + if (isMobileLayout.value) { + return ( + +
+ +
+
+
+ + +
+ +
+ +
+ +
+ +
+
+
+ ); + } + return (