Rename .flex-item-equal to .flex-1#966
Conversation
|
This pull request is being automatically deployed with ZEIT Now (learn more). 🔍 Inspect: https://zeit.co/primer/primer-css/puatm5zo9 |
| .flex#{$variant}-auto { flex: 1 1 auto !important; } | ||
| .flex#{$variant}-grow-0 { flex-grow: 0 !important; } | ||
| .flex#{$variant}-1 { flex: 1 !important; } | ||
| .flex#{$variant}-auto { flex: auto !important; } |
| flex-grow: 1; | ||
| flex-basis: 0; |
There was a problem hiding this comment.
Replacing
.flex-item-equal {
flex-grow: 1;
flex-basis: 0;
}with
.flex-1 { flex: 1; }should be ok, since flex-shrink: 1 is the default for flex items and flex: 1 gets computed as:
.flex-1 {
flex-grow: 1;
flex-shrink: 1;
flex-basis: 0%;
}
shawnbot
left a comment
There was a problem hiding this comment.
This is great. Thanks for documenting the initial values of the other flex properties; that makes me much more confident about rolling this out! There are only a couple dozen instances of flex-item-equal (and responsive variants; looks like just flex-md-item-equal) to replace in github/github.

This renames the
.flex-item-equalutility to.flex-1.Motivation
Currently when using
.flex-autoand a sibling element is an image or icon, the image or icon can start to shrink. A workaround is to add.flex-shrink-0to the sibling element.Another workaround would be to use
flex: 1instead offlex: auto. It's similar but has aflex-basisvalue of0%. It seems to be less "aggressive" and respect the min-width of sibling elements. And thus no.flex-shrink-0is necessary on the avatar:Turns out that
.flex-item-equalcould be used. Becauseflex-shrink: 1is the default, is has the same computed values as using the shorthandflex: 1->flex: 1 1 0%->flex-grow: 1; flex-shrink: 1; flex-basis: 0%. Maybe it doesn't get used as much because:flex-auto.!importantand can't be used to override.So renaming the utility might help. The recommendation would be:
.flex-1. In most situations it should be enough..flex-autoif a flex item should take up space based on its content. Add.flex-shrink-0to sibling elements that are images or icons.👀 See docs preview.
TODO
.flex-item-equal.flex-1TODO in
release-14.0.0.flex-item-equalclassTODO on dotcom
.flex-item-equalwith.flex-1/cc @primer/ds-core