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

Grid: Rename Flex to Fraction #350

Merged

Conversation

nicoburns
Copy link
Collaborator

@nicoburns nicoburns commented Feb 3, 2023

Objective

This is to more closely align our naming with the spec:

  • Renames MaxTrackSizingFunction::Flex to MaxTrackSizingFunction::Fraction
  • Renames flex() helper to fr()
  • Creates a new helper function called flex() that resolves to minmax(0px, Nfr)

The unit is called fr in the spec (although it does also talk about "flexible track sizing functions".

The flex() helper is to try to encourage people to use minmax(0px 1fr) - this is much faster than plain 1fr as it doesn't have to do any content sizing. Hopefully the pattern for "4 evenly sized tracks" can be something like:

grid_template_columns: repeat(4, flex(1.0))

although the following would also work and be just as effcient

grid_template_columns: repeat(4, percent(1/4))

Feedback wanted

Does this naming make sense?

EDIT: Would it perhaps be better to leave the naming as it is and create an evenly_sized_tracks(count: u16) helper that directly creates a repeat(4, flex(1.0))?

@nicoburns nicoburns added usability Make the library more comfortable to use breaking-change A change that breaks our public interface labels Feb 3, 2023
@alice-i-cecile
Copy link
Collaborator

create an evenly_sized_tracks(count: u16) helper that directly creates a repeat(4, flex(1.0))?

I like this naming, but I'd also like this helper method.

@nicoburns
Copy link
Collaborator Author

create an evenly_sized_tracks(count: u16) helper that directly creates a repeat(4, flex(1.0))?

I like this naming, but I'd also like this helper method.

Helper method added :)

nicoburns added a commit to nicoburns/taffy that referenced this pull request Feb 7, 2023
@nicoburns nicoburns mentioned this pull request Feb 7, 2023
5 tasks
@nicoburns nicoburns added this to the 0.3 "CSS Grid" milestone Feb 7, 2023
@alice-i-cecile alice-i-cecile merged commit 71027a8 into DioxusLabs:main Feb 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change A change that breaks our public interface usability Make the library more comfortable to use
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants