Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Style API tweaks #881

Merged
merged 2 commits into from
Aug 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions mesop/component_helpers/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ class Style:
]
| None
) = None
flex: str | None = None
flex: int | str | None = None
flex_basis: str | None = None
flex_direction: (
Literal[
Expand All @@ -426,6 +426,7 @@ class Style:
Literal[
"bold",
"normal",
"medium",
100,
200,
300,
Expand Down Expand Up @@ -579,7 +580,7 @@ def to_style_proto(s: Style) -> pb.Style:
columns=_int_str(s.columns),
cursor=s.cursor,
display=s.display,
flex=s.flex,
flex=_int_str(s.flex),
flex_basis=s.flex_basis,
flex_direction=s.flex_direction,
flex_grow=s.flex_grow,
Expand Down Expand Up @@ -649,6 +650,8 @@ def to_style_proto(s: Style) -> pb.Style:
def _map_font_weight(fw: int | str | None) -> str:
if fw is None:
return ""
if fw == "medium":
return "500"
return str(fw)


Expand Down
Loading