Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Jan 5, 2023
1 parent af4bb4d commit 99e0e42
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
26 changes: 14 additions & 12 deletions packages/edit-site/src/components/layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ export default function Layout( { onError } ) {
const [ fullResizer, fullSize ] = useResizeObserver();
const [ forcedWidth, setForcedWidth ] = useState( null );
const [ isResizing, setIsResizing ] = useState( false );
const isResizingEnabled = ! isMobileViewport && canvasMode === 'view';
const defaultSidebarWidth = isMobileViewport ? '100vw' : 360;
useEffect( () => {
if ( canvasMode === 'view' && isMobileViewport ) {
setIsMobileCanvasVisible( false );
Expand Down Expand Up @@ -129,7 +131,10 @@ export default function Layout( { onError } ) {
<SiteHub
className="edit-site-layout__hub"
style={ {
width: forcedWidth ? forcedWidth - 48 : undefined,
width:
isResizingEnabled && forcedWidth
? forcedWidth - 48
: undefined,
} }
isMobileCanvasVisible={ isMobileCanvasVisible }
setIsMobileCanvasVisible={ setIsMobileCanvasVisible }
Expand Down Expand Up @@ -188,18 +193,13 @@ export default function Layout( { onError } ) {
size={ {
height: '100%',
width:
! isMobileViewport &&
isEditorPage &&
canvasMode === 'view'
? forcedWidth ?? 360
: undefined,
isResizingEnabled && forcedWidth
? forcedWidth
: defaultSidebarWidth,
} }
className="edit-site-layout__sidebar"
enable={ {
right:
! isMobileViewport &&
isEditorPage &&
canvasMode === 'view',
right: isResizingEnabled,
} }
onResizeStop={ ( event, direction, elt ) => {
setForcedWidth( elt.clientWidth );
Expand All @@ -215,9 +215,11 @@ export default function Layout( { onError } ) {
handleStyles={ {
right: emptyResizeHandleStyles,
} }
minWidth={ 320 }
minWidth={ isResizingEnabled ? 320 : undefined }
maxWidth={
fullSize ? fullSize.width - 360 : undefined
isResizingEnabled && fullSize
? fullSize.width - 360
: undefined
}
>
<NavigableRegion
Expand Down
2 changes: 1 addition & 1 deletion packages/edit-site/src/components/layout/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ $hub-height: $grid-unit-20 * 2 + $button-size;

// This is only necessary for the exit animation
.edit-site-layout.is-full-canvas & {
position: fixed;
position: fixed !important;
height: 100vh;
left: 0;
top: 0;
Expand Down

1 comment on commit 99e0e42

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/3847118714
📝 Reported issues:

Please sign in to comment.