Skip to content

Commit 3513f0a

Browse files
committed
MC-3870: Background does not conform to border radius for banner, image, contained row & video
Add/utilize overlay-border-radius converter to fix overlay border radius
1 parent 65db346 commit 3513f0a

File tree

3 files changed

+43
-1
lines changed

3 files changed

+43
-1
lines changed

app/code/Magento/PageBuilder/view/adminhtml/pagebuilder/content_type/banner.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@
276276
<attribute name="virtual_link_type" storage_key="link_url" source="data-link-type" converter="Magento_PageBuilder/js/converter/attribute/link-type" persistence_mode="write"/>
277277
</element>
278278
<element name="overlay">
279+
<style name="border_radius" source="border_radius" converter="Magento_PageBuilder/js/converter/style/overlay-border-radius"/>
279280
<style name="min_height" source="min_height" converter="Magento_PageBuilder/js/converter/style/remove-px"/>
280281
<style name="background_color" source="background_color" converter="Magento_PageBuilder/js/content-type/banner/converter/style/overlay-background-color" persistence_mode="write"/>
281282
<style name="margins_and_padding" reader="Magento_PageBuilder/js/property/paddings" converter="Magento_PageBuilder/js/converter/style/paddings"/>

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
-moz-transition: background-color 500ms ease;
1616
-o-transition: background-color 500ms ease;
1717
-webkit-transition: background-color 500ms ease;
18-
border-radius: inherit;
1918
transition: background-color 500ms ease;
2019
}
2120

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/**
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
import {DataObject} from "../../data-store";
7+
import ConverterInterface from "../converter-interface";
8+
9+
/**
10+
* Takes difference of border width from border radius to conform snugly to edges of wrapper border
11+
*
12+
* @api
13+
*/
14+
export default class OverlayBorderRadius implements ConverterInterface {
15+
/**
16+
* Convert value to internal format
17+
*
18+
* @param value string
19+
* @returns {string}
20+
*/
21+
public fromDom(value: string): string | object {
22+
return value;
23+
}
24+
25+
/**
26+
* Convert value to knockout format
27+
*
28+
* @param {string} name
29+
* @param {DataObject} data
30+
* @returns {string}
31+
*/
32+
public toDom(name: string, data: DataObject): string | object {
33+
const borderRadius = data.border_radius ? parseInt(data.border_radius as string, 10) : 0;
34+
const borderWidth = data.border_width ? parseInt(data.border_width as string, 10) : 0;
35+
36+
if (borderRadius <= borderWidth) {
37+
return "0";
38+
}
39+
40+
return (borderRadius - borderWidth) + "px";
41+
}
42+
}

0 commit comments

Comments
 (0)