Skip to content

Commit cc95320

Browse files
committed
MC-1263: Buttons of Image Content Block are not aligned correctly
- Updated with Cr feedback
1 parent 91d206b commit cc95320

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

app/code/Magento/PageBuilder/view/adminhtml/web/js/form/element/image-uploader.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ define([
2626
draggingInside: 'dragging-inside',
2727
draggingOutside: 'dragging-outside'
2828
},
29+
// listed in ascending order
30+
elementWidthModifierClasses: {
31+
'_micro-ui': 130,
32+
'_compact-ui': 440
33+
},
2934
translations: {
3035
allowedFileTypes: $t('Allowed file types'),
3136
dragImageHere: $t('Drag image here'),
@@ -155,16 +160,18 @@ define([
155160
* Adds the appropriate ui state class to the upload control area based on the current rendered size
156161
*/
157162
updateResponsiveClasses: function () {
163+
var modifierClass;
164+
158165
if (!this.$uploadArea.is(':visible')) {
159166
return;
160167
}
161168

162-
this.$uploadArea.removeClass('_micro-ui _compact-ui');
169+
this.$uploadArea.removeClass(Object.keys(this.elementWidthModifierClasses).join(' '));
163170

164-
if (this.$uploadArea.width() < 130) {
165-
this.$uploadArea.addClass('_micro-ui');
166-
} else if (this.$uploadArea.width() < 440) {
167-
this.$uploadArea.addClass('_compact-ui');
171+
for (modifierClass in this.elementWidthModifierClasses) {
172+
if (this.$uploadArea.width() < this.elementWidthModifierClasses[modifierClass]) {
173+
this.$uploadArea.addClass(modifierClass);
174+
}
168175
}
169176
}
170177
});

0 commit comments

Comments
 (0)