Skip to content

Commit

Permalink
Update all block previews to use the auto-height behavior (#21014)
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad authored Mar 24, 2020
1 parent f132100 commit 622362a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
1 change: 1 addition & 0 deletions packages/block-editor/src/components/block-styles/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ function BlockStyles( {
>
<div className="block-editor-block-styles__item-preview">
<BlockPreview
autoHeight
viewportWidth={ 500 }
blocks={
type.example
Expand Down
14 changes: 5 additions & 9 deletions packages/block-editor/src/components/block-styles/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
overflow: hidden;
border-radius: $radius-round-rectangle;
padding: $grid-unit-05 * 1.5;
padding-top: calc(50% * 0.75 - #{ $grid-unit-05 } * 1.5);
display: flex;
flex-direction: column;

&:focus {
@include block-style__focus();
Expand Down Expand Up @@ -46,14 +47,9 @@
display: flex;
overflow: hidden;
background: $white;
padding-top: 75%;
margin-top: -75%;

.block-editor-block-preview__container {
padding-top: 0;
margin: 0;
margin-top: -75%;
}
align-items: center;
flex-grow: 1;
min-height: 80px;
}

.block-editor-block-styles__item-label {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ export class BlockSwitcher extends Component {
{ __( 'Preview' ) }
</div>
<BlockPreview
autoHeight
viewportWidth={ 500 }
blocks={
hoveredBlockType.example
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function TemplatePartPreview() {
<div className="wp-block-template-part__placeholder-preview-title">
{ __( 'Preview' ) }
</div>
<BlockPreview blocks={ blocks } />
<BlockPreview blocks={ blocks } autoHeight />
</div>
);
}
Expand Down

0 comments on commit 622362a

Please sign in to comment.