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

fix(button): Stroked buttons should change the padding of the button #1538

Merged
merged 5 commits into from
Nov 3, 2017
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions packages/mdc-button/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,21 @@
// Note: line height is adjusted for stroke button because borders are not
// considered as space available to text on the Web
line-height: $mdc-button-height - $stroke-width * 2;
// Note: Adjust padding to maintain consistent width with non-stroked buttons
$padding-value: max($mdc-button-horizontal-padding - $stroke-width, 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might want a comment above this too, e.g. "Adjust padding to maintain consistent width with non-stroked buttons"

👍 to centralizing this though; this actually makes the demo page line up nicer, in addition to allowing for stroke width changes across states for a single button without affecting its width.

padding-left: $padding-value;
padding-right: $padding-value;

// postcss-bem-linter: ignore
&.mdc-button--dense {
// Minus extra 1 to accommodate odd font size of dense button
line-height: $mdc-dense-button-height - $stroke-width * 2 - 1;
}
&.mdc-button--compact {
$padding-compact-value: max($mdc-compact-button-horizontal-padding - $stroke-width, 0);
padding-left: $padding-value;
padding-right: $padding-value;
}
}

@mixin mdc-button-base_() {
Expand All @@ -82,7 +91,7 @@
box-sizing: border-box;
min-width: 64px;
height: $mdc-button-height;
padding: 0 16px;
padding: 0 $mdc-button-horizontal-padding;
border: none;
outline: none;
text-align: center;
Expand Down Expand Up @@ -171,7 +180,7 @@
}

@mixin mdc-button--compact_() {
padding: 0 8px;
padding: 0 $mdc-compact-button-horizontal-padding;
}

@mixin mdc-button--dense_() {
Expand Down
2 changes: 2 additions & 0 deletions packages/mdc-button/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
//

$mdc-button-height: 36px;
$mdc-button-horizontal-padding: 16px;
$mdc-dense-button-height: 32px;
$mdc-compact-button-horizontal-padding: 8px;

$mdc-unfilled-button-ripple-opacity: .16;
$mdc-filled-button-ripple-opacity: .32;