diff --git a/packages/edit-site/src/components/layout/index.js b/packages/edit-site/src/components/layout/index.js index cd7890649c60af..17c660b94f0036 100644 --- a/packages/edit-site/src/components/layout/index.js +++ b/packages/edit-site/src/components/layout/index.js @@ -121,6 +121,8 @@ export default function Layout() { const [ fullResizer ] = useResizeObserver(); const [ isResizing ] = useState( false ); const isEditorLoading = useIsSiteEditorLoading(); + const [ isResizableFrameOversized, setIsResizableFrameOversized ] = + useState( false ); // This determines which animation variant should apply to the header. // There is also a `isDistractionFreeHovering` state that gets priority @@ -218,6 +220,7 @@ export default function Layout() { edit: { x: 0 }, } } ref={ hubRef } + isTransparent={ isResizableFrameOversized } className="edit-site-layout__hub" /> @@ -315,7 +318,13 @@ export default function Layout() { } initial={ false } layout="position" - className="edit-site-layout__canvas" + className={ classnames( + 'edit-site-layout__canvas', + { + 'is-right-aligned': + isResizableFrameOversized, + } + ) } transition={ { type: 'tween', duration: @@ -331,7 +340,12 @@ export default function Layout() { ! isEditorLoading } isFullWidth={ isEditing } - oversizedClassName="edit-site-layout__resizable-frame-oversized" + isOversized={ + isResizableFrameOversized + } + setIsOversized={ + setIsResizableFrameOversized + } innerContentStyle={ { background: gradientValue ?? diff --git a/packages/edit-site/src/components/layout/style.scss b/packages/edit-site/src/components/layout/style.scss index e5661c61eb7897..2fc8bbc6a5091e 100644 --- a/packages/edit-site/src/components/layout/style.scss +++ b/packages/edit-site/src/components/layout/style.scss @@ -121,7 +121,7 @@ justify-content: center; align-items: center; - &:has(.edit-site-layout__resizable-frame-oversized) { + &.is-right-aligned { justify-content: flex-end; } diff --git a/packages/edit-site/src/components/resizable-frame/index.js b/packages/edit-site/src/components/resizable-frame/index.js index 1bb9315a07e38a..2b98e46a71532e 100644 --- a/packages/edit-site/src/components/resizable-frame/index.js +++ b/packages/edit-site/src/components/resizable-frame/index.js @@ -78,9 +78,10 @@ function calculateNewHeight( width, initialAspectRatio ) { function ResizableFrame( { isFullWidth, + isOversized, + setIsOversized, isReady, children, - oversizedClassName, innerContentStyle, } ) { const [ frameSize, setFrameSize ] = useState( INITIAL_FRAME_SIZE ); @@ -88,7 +89,6 @@ function ResizableFrame( { const [ startingWidth, setStartingWidth ] = useState(); const [ isResizing, setIsResizing ] = useState( false ); const [ shouldShowHandle, setShouldShowHandle ] = useState( false ); - const [ isOversized, setIsOversized ] = useState( false ); const [ resizeRatio, setResizeRatio ] = useState( 1 ); const canvasMode = useSelect( ( select ) => unlock( select( editSiteStore ) ).getCanvasMode(), @@ -314,7 +314,6 @@ function ResizableFrame( { onResizeStop={ handleResizeStop } className={ classnames( 'edit-site-resizable-frame__inner', { 'is-resizing': isResizing, - [ oversizedClassName ]: isOversized, } ) } > { +const SiteHub = forwardRef( ( { isTransparent, ...restProps }, ref ) => { const { canvasMode, dashboardLink, homeUrl, siteTitle } = useSelect( ( select ) => { const { getCanvasMode, getSettings } = unlock( @@ -84,8 +84,11 @@ const SiteHub = forwardRef( ( props, ref ) => { return ( { spacing="0" > { exit={ { opacity: 0, } } - className="edit-site-site-hub__site-title" + className={ classnames( + 'edit-site-site-hub__site-title', + { 'is-transparent': isTransparent } + ) } transition={ { type: 'tween', duration: disableMotion ? 0 : 0.2, @@ -174,7 +185,10 @@ const SiteHub = forwardRef( ( props, ref ) => { { canvasMode === 'view' && (