From 94447e0b8176ad8c059a93d466d54efa1b27e774 Mon Sep 17 00:00:00 2001 From: lynnjepsen Date: Thu, 2 Nov 2017 17:23:29 -0700 Subject: [PATCH 1/3] fix(button): Stroked buttons should change the padding of the button --- packages/mdc-button/_mixins.scss | 12 ++++++++++-- packages/mdc-button/_variables.scss | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/mdc-button/_mixins.scss b/packages/mdc-button/_mixins.scss index 5afa68ab85a..2b7d39aa88f 100644 --- a/packages/mdc-button/_mixins.scss +++ b/packages/mdc-button/_mixins.scss @@ -64,12 +64,20 @@ // 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; + $padding-value: max($mdc-button-horizontal-padding - $stroke-width, 0); + 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_() { @@ -82,7 +90,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; @@ -171,7 +179,7 @@ } @mixin mdc-button--compact_() { - padding: 0 8px; + padding: 0 $mdc-compact-button-horizontal-padding; } @mixin mdc-button--dense_() { diff --git a/packages/mdc-button/_variables.scss b/packages/mdc-button/_variables.scss index d608af4d99e..5115d3e17e6 100644 --- a/packages/mdc-button/_variables.scss +++ b/packages/mdc-button/_variables.scss @@ -15,7 +15,9 @@ // $mdc-button-height: 36px; +$mdc-button-horizontal-padding: 16px; $mdc-dense-button-height: 32px; +$mdc-compact-button-horizontal-padding: 16px; $mdc-unfilled-button-ripple-opacity: .16; $mdc-filled-button-ripple-opacity: .32; From bebc537df9fdb2b7d91b21c45278e292ab1727e8 Mon Sep 17 00:00:00 2001 From: lynnjepsen Date: Fri, 3 Nov 2017 09:56:42 -0700 Subject: [PATCH 2/3] add comment and fix compact padding --- packages/mdc-button/_mixins.scss | 1 + packages/mdc-button/_variables.scss | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/mdc-button/_mixins.scss b/packages/mdc-button/_mixins.scss index 2b7d39aa88f..5c22816b4f8 100644 --- a/packages/mdc-button/_mixins.scss +++ b/packages/mdc-button/_mixins.scss @@ -64,6 +64,7 @@ // 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); padding-left: $padding-value; padding-right: $padding-value; diff --git a/packages/mdc-button/_variables.scss b/packages/mdc-button/_variables.scss index 5115d3e17e6..373c10ba75e 100644 --- a/packages/mdc-button/_variables.scss +++ b/packages/mdc-button/_variables.scss @@ -17,7 +17,7 @@ $mdc-button-height: 36px; $mdc-button-horizontal-padding: 16px; $mdc-dense-button-height: 32px; -$mdc-compact-button-horizontal-padding: 16px; +$mdc-compact-button-horizontal-padding: 8px; $mdc-unfilled-button-ripple-opacity: .16; $mdc-filled-button-ripple-opacity: .32; From f5c59178b50700259c90df5a153c9e10aa99c09b Mon Sep 17 00:00:00 2001 From: lynnjepsen Date: Fri, 3 Nov 2017 10:19:09 -0700 Subject: [PATCH 3/3] fix linting --- packages/mdc-button/_mixins.scss | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/mdc-button/_mixins.scss b/packages/mdc-button/_mixins.scss index 5c22816b4f8..031c8d7ce68 100644 --- a/packages/mdc-button/_mixins.scss +++ b/packages/mdc-button/_mixins.scss @@ -60,24 +60,27 @@ } @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 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); - 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; + + padding-right: $padding-compact-value; + padding-left: $padding-compact-value; } }