Skip to content

Commit 52fdb00

Browse files
MC-855: Pagebuilder - Tab Minimum Height Displays Differently On Stage & Storefront
1 parent d4da457 commit 52fdb00

File tree

6 files changed

+54
-10
lines changed

6 files changed

+54
-10
lines changed

app/code/Magento/PageBuilder/view/adminhtml/web/css/source/content-type/_preview.less

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,22 @@
5454

5555
&.empty-placeholder {
5656
-moz-transition: .3s;
57-
-webkit-transition: .3s;
58-
background: url('@{baseDir}Magento_PageBuilder/css/images/cms-empty-row.svg') no-repeat center center;
59-
background-size: 505px 97px;
60-
height: 170px;
6157
left: 0;
62-
padding-top: 130px;
63-
position: absolute;
6458
text-align: center;
6559
transition: .3s;
6660
width: 100%;
6761
z-index: 1;
6862
}
63+
64+
&.empty-placeholder-background {
65+
background: url('@{baseDir}Magento_PageBuilder/css/images/cms-empty-row.svg') no-repeat center center;
66+
background-size: 505px 97px;
67+
box-sizing: border-box;
68+
height: 170px;
69+
-webkit-transition: .3s;
70+
padding-top: 130px;
71+
position: absolute;
72+
}
6973
}
7074

7175
.element-children {

app/code/Magento/PageBuilder/view/adminhtml/web/js/content-type/preview.js

Lines changed: 19 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/code/Magento/PageBuilder/view/adminhtml/web/template/content-type/row/default/preview.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,7 @@
99
<render args="getOptions().template"/>
1010
<render args="previewChildTemplate"/>
1111
<div class="pagebuilder-display-label" data-bind="text: function () { return displayLabel().toUpperCase(); }()"></div>
12-
<div class="pagebuilder-empty-container empty-placeholder" data-bind="css: {visible: parent.children().length == 0}, i18n: 'Drag content types or columns here'"></div>
12+
<div class="pagebuilder-empty-container empty-placeholder"
13+
css="getPlaceholderStyles()"
14+
translate="'Drag content types or columns here'"/>
1315
</div>

app/code/Magento/PageBuilder/view/adminhtml/web/template/content-type/tab-item/default/preview.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,7 @@
77

88
<div class="pagebuilder-content-type type-container pagebuilder-tab-item" attr="Object.assign({}, {id: parent.id}, data.main.attributes())" ko-style="Object.assign({}, data.main.style(), {borderRadius: data.main.style().borderRadius || $parent.parent.preview.data.headers.style().borderRadius})" css="Object.assign({'empty-container': parent.children().length == 0}, data.main.css())">
99
<render args="previewChildTemplate" />
10-
<div class="pagebuilder-empty-container empty-placeholder" css="{visible: parent.children().length == 0}" translate="'Drag content types or columns here'"></div>
10+
<div class="pagebuilder-empty-container empty-placeholder"
11+
css="getPlaceholderStyles()"
12+
translate="'Drag content types or columns here'"/>
1113
</div>

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/content-type/preview.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,4 +561,22 @@ export default class Preview {
561561
this.afterObservablesUpdated();
562562
events.trigger("previewData:updateAfter", {preview: this});
563563
}
564+
565+
/**
566+
* Show/hide empty placeholder
567+
* @returns {object}
568+
*/
569+
public getPlaceholderStyles(): object {
570+
let style = this.data.main.style(),
571+
minHeight = parseFloat(style.minHeight) || 300,
572+
paddingBottom = parseFloat(style.paddingBottom) || 0,
573+
paddingTop = parseFloat(style.paddingBottom) || 0,
574+
isBackgroundVisible = paddingBottom + paddingTop + minHeight > 130,
575+
isVisible = this.parent.children().length == 0;
576+
577+
return {
578+
visible: isVisible,
579+
'empty-placeholder-background': isBackgroundVisible
580+
}
581+
}
564582
}

app/code/Magento/PageBuilder/view/frontend/web/css/source/content-type/tabs/_default.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ div[data-role='tabs'] {
8383
z-index: 9;
8484

8585
[data-role='tab-item'] {
86-
box-sizing: border-box;
86+
box-sizing: content-box;
8787
min-height: inherit;
8888

8989
&:not(:first-child) {

0 commit comments

Comments
 (0)