diff --git a/code/core/src/manager/components/layout/Layout.tsx b/code/core/src/manager/components/layout/Layout.tsx index 32bc1e009326..038db9fc73ba 100644 --- a/code/core/src/manager/components/layout/Layout.tsx +++ b/code/core/src/manager/components/layout/Layout.tsx @@ -156,26 +156,16 @@ export const Layout = ({ managerLayoutState, setManagerLayoutState, hasTab, ...s sidebarResizerRef, showPages, showPanel, - isDragging, } = useLayoutSyncingState({ api, managerLayoutState, setManagerLayoutState, isDesktop, hasTab }); // Install landmark navigation listener in parent container of all landmarks. useLandmarkIndicator(); return ( - - {showPages && {slots.slotPages}} + <> {isDesktop && ( - + {slots.slotSidebar} @@ -188,62 +178,83 @@ export const Layout = ({ managerLayoutState, setManagerLayoutState, hasTab, ...s /> )} - {slots.slotMain} - - {isDesktop && showPanel && ( - - - {slots.slotPanel} - - )} + + {showPages ? ( + {slots.slotPages} + ) : ( + {slots.slotMain} + )} + {isDesktop && showPanel && ( + + + + + )} + + {isMobile && } ); }; -const LayoutContainer = styled.div( - ({ navSize, rightPanelWidth, bottomPanelHeight, viewMode, panelPosition, showPanel }) => { - return { - width: '100%', - height: ['100vh', '100dvh'], // This array is a special Emotion syntax to set a fallback if 100dvh is not supported - overflow: 'hidden', - display: 'flex', - flexDirection: 'column', - colorScheme: 'light dark', - - [MEDIA_DESKTOP_BREAKPOINT]: { - display: 'grid', - gap: 0, - gridTemplateColumns: `minmax(0, ${navSize}px) minmax(${MINIMUM_CONTENT_WIDTH_PX}px, 1fr) minmax(0, ${rightPanelWidth}px)`, - gridTemplateRows: `1fr minmax(0, ${bottomPanelHeight}px)`, - gridTemplateAreas: (() => { - if (!showPanel) { - // showPanel is false by default when viewMode is not 'story', but can be overridden by the user - return `"sidebar content content" - "sidebar content content"`; - } - if (panelPosition === 'right') { - return `"sidebar content panel" - "sidebar content panel"`; - } - return `"sidebar content content" - "sidebar panel panel"`; - })(), - }, - }; - } -); +const LayoutContainer = styled.div({ + width: '100%', + height: ['100vh', '100dvh'], // This array is a special Emotion syntax to set a fallback if 100dvh is not supported + overflow: 'hidden', + display: 'flex', + flexDirection: 'column', + colorScheme: 'light dark', + + [MEDIA_DESKTOP_BREAKPOINT]: { + flexDirection: 'row', + }, +}); const SidebarContainer = styled.div(({ theme }) => ({ backgroundColor: theme.appBg, - gridArea: 'sidebar', position: 'relative', borderRight: `1px solid ${theme.appBorderColor}`, + + [MEDIA_DESKTOP_BREAKPOINT]: { + flexShrink: 0, + }, +})); + +const ContentPanelWrapper = styled.div<{ + panelPosition: LayoutState['panelPosition']; + showPanel: boolean; + rightPanelWidth: number; + bottomPanelHeight: number; +}>(({ panelPosition }) => ({ + display: 'flex', + overflow: 'hidden', + flex: 1, + minWidth: 0, + flexDirection: panelPosition === 'bottom' ? 'column' : 'row', })); const ContentContainer = styled.div<{ shown: boolean }>(({ theme, shown }) => ({ @@ -252,27 +263,23 @@ const ContentContainer = styled.div<{ shown: boolean }>(({ theme, shown }) => ({ backgroundColor: theme.appContentBg, display: shown ? 'grid' : 'none', // This is needed to make the content container fill the available space overflow: 'auto', + minWidth: MINIMUM_CONTENT_WIDTH_PX, [MEDIA_DESKTOP_BREAKPOINT]: { flex: 'auto', - gridArea: 'content', }, })); const PagesContainer = styled.div(({ theme }) => ({ display: 'flex', flexDirection: 'column', - gridRowStart: 'sidebar-start', - gridRowEnd: '-1', - gridColumnStart: 'sidebar-end', - gridColumnEnd: '-1', + flexGrow: 1, backgroundColor: theme.appContentBg, zIndex: 1, })); const PanelContainer = styled.div<{ position: LayoutState['panelPosition'] }>( ({ theme, position }) => ({ - gridArea: 'panel', position: 'relative', backgroundColor: theme.appContentBg, borderTop: position === 'bottom' ? `1px solid ${theme.appBorderColor}` : undefined, @@ -280,6 +287,10 @@ const PanelContainer = styled.div<{ position: LayoutState['panelPosition'] }>( }) ); +const PanelSlot = styled.div({ + height: '100%', +}); + const Drag = styled.div<{ orientation?: 'horizontal' | 'vertical'; position?: 'left' | 'right' }>( ({ theme }) => ({ position: 'absolute',