Skip to content

Commit

Permalink
limit the resize behaviour to is-large placeholders
Browse files Browse the repository at this point in the history
Reverting changes to the Placeholder `useResizeObserver` since it was a test.
limit the resize behaviour to `is-large` placeholders
  • Loading branch information
ramonjd committed Sep 30, 2021
1 parent bbbb1cd commit 20ddf00
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 19 deletions.
22 changes: 7 additions & 15 deletions packages/block-library/src/cover/editor.scss
Expand Up @@ -119,25 +119,17 @@

// Resizeable placeholder
.wp-block-cover.is-placeholder .cover-block__cover-placeholder-container {
.components-resizable-box__container {
display: none;
}
.components-placeholder {
&.is-tall {
justify-content: flex-start;
&.is-large {
min-height: 250px;
.components-resizable-box__container {
min-height: 250px;
}
}

&.is-middle {
min-height: 150px;
.components-resizable-box__container {
min-height: 150px;
}
}

&.is-short {
min-height: 100px;
.components-resizable-box__container {
min-height: 100px;
min-height: 250px;
display: block;
}
}
}
Expand Down
5 changes: 1 addition & 4 deletions packages/components/src/placeholder/index.js
Expand Up @@ -39,7 +39,7 @@ function Placeholder( {
isColumnLayout,
...additionalProps
} ) {
const [ resizeListener, { width, height } ] = useResizeObserver();
const [ resizeListener, { width } ] = useResizeObserver();

// Since `useResizeObserver` will report a width of `null` until after the
// first render, avoid applying any modifier classes until width is known.
Expand All @@ -49,9 +49,6 @@ function Placeholder( {
'is-large': width >= 480,
'is-medium': width >= 160 && width < 480,
'is-small': width < 160,
'is-tall': height >= 250,
'is-middle': height >= 100 && height < 250,
'is-short': height < 100,
};
}

Expand Down

0 comments on commit 20ddf00

Please sign in to comment.