@@ -3,8 +3,6 @@ import { StepDefinition } from '@wp-playground/blueprints';
33import { startPlaygroundWeb } from '@wp-playground/client' ;
44import { cx } from 'class-variance-authority' ;
55import { useEffect , useRef , useTransition } from 'react' ;
6- import { Group , Panel , Separator } from 'react-resizable-panels' ;
7- import { useMedia } from 'react-use' ;
86
97import { AlleyLogo } from '@/components/alley' ;
108import { ConsolePanel , EditorPanel , OutputPanel , SettingsPanel } from '@/components/playground/index' ;
@@ -26,7 +24,6 @@ export default function Playground() {
2624 const { state, dispatch } = usePlaygroundState ( ) ;
2725 const { code, browserShowing, consoleShowing, multisite, phpVersion, plugins, playgroundClient, ready, themes, wordPressVersion } = state ;
2826 const iframe = useRef < HTMLIFrameElement > ( null ) ;
29- const isDesktop = useMedia ( '(min-width: 1024px)' , true ) ;
3027
3128 useEffect ( ( ) => {
3229 if ( ! ready ) {
@@ -209,69 +206,40 @@ export default function Playground() {
209206 </ div >
210207 </ header >
211208 < div className = "flex h-full w-full flex-1 flex-col overflow-auto" >
212- { isDesktop && ( browserShowing || consoleShowing ) ? (
213- // Desktop with browser/console: vertical resizable layout
214- < Group orientation = "vertical" className = "h-full w-full" >
215- < Panel defaultSize = "50%" minSize = "20%" >
216- < div className = "flex h-full overflow-hidden" >
217- < Group orientation = "horizontal" className = "h-full w-full" >
218- < Panel defaultSize = "50%" minSize = "20%" >
219- < EditorPanel />
220- </ Panel >
221- < Separator className = "bg-border w-1 cursor-col-resize transition-colors hover:bg-blue-500 active:bg-blue-600" />
222- < Panel defaultSize = "50%" minSize = "20%" >
223- < OutputPanel />
224- </ Panel >
225- </ Group >
226- </ div >
227- </ Panel >
228- < Separator className = "bg-border h-1 cursor-row-resize transition-colors hover:bg-blue-500 active:bg-blue-600" />
229- < Panel defaultSize = "50%" minSize = "20%" >
230- < div className = "flex h-full w-full flex-row" >
231- < iframe
232- ref = { iframe }
233- className = { cn ( 'h-full' , {
234- hidden : ! browserShowing ,
235- 'w-1/2' : browserShowing && consoleShowing ,
236- 'w-full' : browserShowing && ! consoleShowing ,
237- } ) }
238- id = "wp"
239- title = "WordPress Playground"
240- />
241- < ConsolePanel
242- className = { cn ( 'h-full' , {
243- hidden : ! consoleShowing ,
244- 'w-1/2' : browserShowing && consoleShowing ,
245- 'w-full' : ! browserShowing && consoleShowing ,
246- } ) }
247- />
248- </ div >
249- </ Panel >
250- </ Group >
251- ) : isDesktop ? (
252- // Desktop without browser/console: horizontal resizable layout only
253- < div className = "flex h-full overflow-hidden" >
254- < Group orientation = "horizontal" className = "h-full w-full" >
255- < Panel defaultSize = { 50 } minSize = { 20 } >
256- < EditorPanel />
257- </ Panel >
258- < Separator className = "bg-border w-1 cursor-col-resize transition-colors hover:bg-blue-500 active:bg-blue-600" />
259- < Panel defaultSize = { 50 } minSize = { 20 } >
260- < OutputPanel />
261- </ Panel >
262- </ Group >
209+ { /* Upper container for the textarea and output */ }
210+ < div
211+ className = { cn ( 'relative flex h-full flex-row overflow-hidden' , {
212+ 'lg:h-2/3 lg:border-b' : browserShowing || consoleShowing ,
213+ 'lg:h-full' : ! browserShowing && ! consoleShowing ,
214+ } ) }
215+ >
216+ < EditorPanel />
217+ < OutputPanel />
218+ </ div >
219+
220+ { /* Lower container for the iframe that will allow for a user to resize it to be taller */ }
221+ < div className = { cn ( 'flex flex-1 overflow-hidden' , { hidden : ! browserShowing && ! consoleShowing } ) } >
222+ < div className = "flex h-full w-full flex-row" >
223+ < iframe
224+ ref = { iframe }
225+ className = { cn ( 'hidden h-full lg:block' , {
226+ 'lg:hidden' : ! browserShowing ,
227+ 'lg:w-1/2' : browserShowing && consoleShowing ,
228+ 'lg:w-full' : browserShowing && ! consoleShowing ,
229+ } ) }
230+ id = "wp"
231+ title = "WordPress Playground"
232+ />
233+ < ConsolePanel
234+ className = { cn ( 'hidden' , {
235+ 'h-full lg:block' : consoleShowing ,
236+ 'lg:hidden' : ! console ,
237+ 'lg:w-1/2' : browserShowing && consoleShowing ,
238+ 'lg:w-full' : ! browserShowing && consoleShowing ,
239+ } ) }
240+ />
263241 </ div >
264- ) : (
265- // Mobile: stacked vertical layout (no resizing)
266- < >
267- < div className = "flex h-1/2 w-full flex-col border-b" >
268- < EditorPanel />
269- </ div >
270- < div className = "flex h-1/2 w-full flex-col" >
271- < OutputPanel />
272- </ div >
273- </ >
274- ) }
242+ </ div >
275243 </ div >
276244 < SettingsPanel />
277245 < SharePopover />
0 commit comments