-
Notifications
You must be signed in to change notification settings - Fork 4
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
fix(svgicon): set inline-block #673
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again for the fix~~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
size-limit report
Path | Size |
---|---|
components | 56.05 KB (0%) |
styles | 3.91 KB (0%) |
@@ -1,5 +1,5 @@ | |||
.svgIcon { | |||
@apply inline; | |||
@apply flex-none inline-block; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it odd for the icon to set it's own flex properties?
I wonder if we should leave that up to users of the component. For example, if the LP left nav applies display: flex
, should it be the one to also set any flex properties on the items?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mm fair point. I thought it might have been standard b/c material was doing it but seems they're in the minority actually
56721e9
to
88eb429
Compare
Codecov Report
@@ Coverage Diff @@
## main #673 +/- ##
=======================================
Coverage 90.62% 90.62%
=======================================
Files 23 23
Lines 384 384
Branches 96 96
=======================================
Hits 348 348
Misses 36 36 Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't remember exactly, but what I'm guessing happened is that I didn't see a clear purpose for that CSS and removed it (thinking it might have been a mistake or no longer relevant). Leaving the flex property to the parent makes sense to me; I don't think I would expect that to come on the atomic component (if I were a dev using it in my feature).
Summary:
Related to https://github.com/FB-PLP/traject/pull/8898 -- the old EDSCandidates icon set
flex-none
, while the new EDS icon only setdisplay: inline
. In trying to unravel why, I noticed that:@apply flex-none inline-block
@apply inline
(and then was landed)I think we always wanted
@apply flex-none inline-block
and something got lost in the splitting 🤔display: inline
state that "Any height and width properties will have no effect", which doesn't sound right for svg icon. In contrast,inline-block
does respect height/widthdubious if we want -- consumer can setflex: none
"sizes the flex item according to the width / height of the content, but doesn't allow it to shrink", which we do wantflex
themselvesthese also match the Material UI icon styles
Test Plan:
no visual changes per Percy