Skip to content

Commit

Permalink
fix(button): Stroked buttons should change the padding of the button (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
lynnmercier authored Nov 3, 2017
1 parent b6de688 commit 97e5aa8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 14 additions & 2 deletions packages/mdc-button/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@
}

@mixin mdc-button-stroke-width($stroke-width) {
// Note: Adjust padding to maintain consistent width with non-stroked buttons
$padding-value: max($mdc-button-horizontal-padding - $stroke-width, 0);

padding-right: $padding-value;
padding-left: $padding-value;
border-width: $stroke-width;
// Note: line height is adjusted for stroke button because borders are not
// considered as space available to text on the Web
Expand All @@ -70,6 +75,13 @@
// 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-right: $padding-compact-value;
padding-left: $padding-compact-value;
}
}

@mixin mdc-button-base_() {
Expand All @@ -82,7 +94,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 +183,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;

0 comments on commit 97e5aa8

Please sign in to comment.