Skip to content

Commit a6c0a37

Browse files
committed
Add border radius to style
1 parent 1672421 commit a6c0a37

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

mesop/component_helpers/style.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ class Style:
9595
align_items: Specifies the default alignment for items inside a flexible container. See [MDN doc](https://developer.mozilla.org/en-US/docs/Web/CSS/align-items).
9696
background: Sets the background color or image of the component. See [MDN doc](https://developer.mozilla.org/en-US/docs/Web/CSS/background).
9797
border: Defines the border properties for each side of the component. See [MDN doc](https://developer.mozilla.org/en-US/docs/Web/CSS/border).
98+
border_radius: Defines the border radius. See [MDN doc](https://developer.mozilla.org/en-US/docs/Web/CSS/border-radius).
9899
color: Sets the color of the text inside the component. See [MDN doc](https://developer.mozilla.org/en-US/docs/Web/CSS/color).
99100
columns: Specifies the number of columns in a multi-column element. See [MDN doc](https://developer.mozilla.org/en-US/docs/Web/CSS/columns).
100101
display: Defines the display type of the component. See [MDN doc](https://developer.mozilla.org/en-US/docs/Web/CSS/display).
@@ -133,6 +134,7 @@ class Style:
133134
] | None = None
134135
background: str | None = None
135136
border: Border | None = None
137+
border_radius: int | str | None = None
136138
color: str | None = None
137139
columns: int | None = None
138140
display: Literal[
@@ -220,6 +222,7 @@ def to_style_proto(s: Style) -> pb.Style:
220222
align_items=s.align_items,
221223
background=s.background,
222224
border=_map_border(s.border),
225+
border_radius=_px_str(s.border_radius),
223226
color=s.color,
224227
columns=s.columns,
225228
display=s.display,

mesop/protos/ui.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,12 @@ message UserDefinedType {
216216
repeated Arg args = 1;
217217
}
218218

219+
// Next id: 29
219220
message Style {
220221
optional string align_items = 1;
221222
optional string background = 2;
222223
optional Border border = 3;
224+
optional string border_radius = 28;
223225
optional string color = 4;
224226
optional int32 columns = 5;
225227
optional string display = 6;

mesop/web/src/utils/styles.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ export function formatStyle(styleObj: Style): string {
3131
style += `border-right: ${right.getWidth()} ${right.getStyle()} ${right.getColor()};`;
3232
}
3333
}
34+
if (styleObj.getBorderRadius()) {
35+
style += `border-radius: ${styleObj.getBorderRadius()};`;
36+
}
3437
if (styleObj.getColor()) {
3538
style += `color: ${styleObj.getColor()};`;
3639
}

0 commit comments

Comments
 (0)