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

Allow flex-shrink to be set to 0. #78

Merged
merged 1 commit into from
Mar 21, 2024

Conversation

richard-to
Copy link
Collaborator

@richard-to richard-to commented Mar 21, 2024

The flex-shrink css property could not be set to 0 since Mesop will ignore styles that are "empty".

Normally this is fine, but flex-shrink defaults to 1, which means the "empty" state will make flex-shrink equal to 1. This means that 0 cannot be set for flex-shrink.

To resolve this, we can change the date type to a string in the UI proto.

Example:

import mesop as me

@me.page(path="/flex_shrink")
def main():
  with me.box(style=me.Style(display="flex", flex_shrink="0")):
    me.text("Testing flex shrink")

Also here's a screenshot to check that the property is being set correctly:

Screenshot 2024-03-20 at 8 26 01 PM

Fixes #69

The `flex-shrink` css property could not be set to 0 since Mesop will
ignore styles that are "empty".

Normally this is fine, but `flex-shrink` defaults to 1, which means the
"empty" state will make `flex-shrink` equal to 1. This means that 0
cannot be set for `flex-shrink`.

To resolve this, we can change the date type to a string in the UI
proto.

Example:

```
import mesop as me

@me.page(path="/flex_shrink")
def main():
  with me.box(style=me.Style(display="flex", flex_shrink="0")):
    me.text("Testing flex shrink")
```
@wwwillchen
Copy link
Collaborator

Thanks for contributing!

@wwwillchen wwwillchen merged commit c3b977b into google:main Mar 21, 2024
3 checks passed
wwwillchen pushed a commit to wwwillchen/mesop that referenced this pull request Apr 23, 2024
The `flex-shrink` css property could not be set to 0 since Mesop will
ignore styles that are "empty".

Normally this is fine, but `flex-shrink` defaults to 1, which means the
"empty" state will make `flex-shrink` equal to 1. This means that 0
cannot be set for `flex-shrink`.

To resolve this, we can change the data type to a string in the UI
proto.

Example:

```
import mesop as me

@me.page(path="/flex_shrink")
def main():
  with me.box(style=me.Style(display="flex", flex_shrink="0")):
    me.text("Testing flex shrink")
```
@richard-to richard-to deleted the fix-flex-shrink branch May 4, 2024 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Not able to setflex-shrink=0
2 participants