-
Notifications
You must be signed in to change notification settings - Fork 2.1k
feat(button): Add padding mixin, adjust icon margin #2420
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2420 +/- ##
=======================================
Coverage 98.91% 98.91%
=======================================
Files 104 104
Lines 4234 4234
Branches 534 534
=======================================
Hits 4188 4188
Misses 46 46 Continue to review full report at Codecov.
|
Can you update this CL to handle the MD cases we need to support (like text icon button). Alternatively, you can leave additional comments on #2413. |
I'm totally up for updating this PR, though might need to wait until tomorrow... Maybe just as well since we need to figure out what to do about the text button + icon case anyway. Pasting the list from #2400 to reflect status on this PR:
To me the real kicker is what we expect text buttons with icons to do. Everything else in this PR is really simple so far, and accomplishes this by adding a padding mixin and with minimal impact to the existing stroke mixin (i.e. you automatically get the correct reduced icon margin in all cases). If the icon treatment is consistent across all types of buttons (as it is right now in the PR), this remains simple... if we need to treat icons in flat buttons specially, we need to disentangle what that means for the styles and mixins. Update: I pushed a commit to POC handling flat buttons having even padding while others have the reduced margin for icons. This assumes that whenever our mixins are used for e.g. stroke or fill, that the appropriate modifier class is also used, which I think is a safe assumption based on how our styles are structured (and how our demo page uses our classes and mixins). Update 2: Checked with design and we arrived upon 12px padding on the icon side of the button for contained buttons (vs. 16px on the other side), but equal 8px padding on both sides of the button for flat text buttons. |
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. |
5c84f6c
to
ce28f6e
Compare
CLAs look good, thanks! |
ce28f6e
to
bfcdf7b
Compare
packages/mdc-button/mdc-button.scss
Outdated
@@ -41,6 +41,16 @@ | |||
} | |||
} | |||
|
|||
.mdc-button--raised, | |||
.mdc-button--unelevated, | |||
.mdc-button--raised, |
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.
should --raised be listed twice?
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.
Whoops... clearly I misread a bit when I was looking at the selectors below to apply this to.
@@ -66,9 +66,14 @@ | |||
border-radius: $corner-radius; | |||
} | |||
|
|||
@mixin mdc-button-stroke-width($stroke-width) { | |||
@mixin mdc-button-horizontal-padding($padding) { | |||
padding-right: $padding; |
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.
strictly speaking we should be adding /* @NoFlip */ on these. At the same time, I understand the argument about them being the same. Lets hope that never changes.
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.
Hm, yeah, I didn't think about it here since I know we handle @noflip
within our RTL stuff now, and these styles are equal and not RTL-dependent. If these ever did change to being asymmetrical, we'd absolutely want to add @noflip
(probably automatically via use of mdc-rtl
mixins).
I think if we wanted to take that strict of a stance about @noflip
we'd have several instances across the repo where left and right are equal that we're not flagging right now.
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.
LGTM
This addresses the following:
mdc-button-horizontal-padding
mixin to parameterize left and right padding (one value applies to both)mdc-button-stroke-width
mixin to accept an optional padding parameter, since this mixin adjusts the button padding to maintain the same size when considering the added strokeResolves #2400.