Skip to content

Revert "feat(button): align with 2018 material design spec (#12537)" #13080

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

Merged
merged 1 commit into from
Sep 11, 2018
Merged
Show file tree
Hide file tree
Changes from all 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
9 changes: 5 additions & 4 deletions src/lib/button/_button-base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@

// Flat and raised button standards
$mat-button-padding: 0 16px !default;
$mat-button-min-width: 64px !default;
$mat-button-min-width: 88px !default;
$mat-button-margin: 0 !default;
$mat-button-line-height: 36px !default;
$mat-button-border-radius: 4px !default;
$mat-button-border-radius: 2px !default;
$mat-button-focus-transition: opacity 200ms $swift-ease-in-out-timing-function,
background-color 200ms $swift-ease-in-out-timing-function !default;

// Stroked Button standards
$mat-stroked-button-line-height: $mat-button-line-height - 2;
// Stroked button padding is 1px less horizontally than default/flat/raised
// button's padding.
$mat-stroked-button-line-height: $mat-button-line-height - 2;
$mat-stroked-button-padding: 0 15px;

// Icon Button standards
Expand Down Expand Up @@ -63,7 +64,7 @@ $mat-mini-fab-padding: 8px !default;

&.cdk-keyboard-focused, &.cdk-program-focused {
.mat-button-focus-overlay {
opacity: 0.12;
opacity: 1;
}
}

Expand Down
16 changes: 3 additions & 13 deletions src/lib/button/_button-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
$warn: map-get($theme, warn);

&.mat-primary .mat-button-focus-overlay {
background-color: mat-color($primary);
background-color: mat-color($primary, 0.12);
}

&.mat-accent .mat-button-focus-overlay {
background-color: mat-color($accent);
background-color: mat-color($accent, 0.12);
}

&.mat-warn .mat-button-focus-overlay {
background-color: mat-color($warn);
background-color: mat-color($warn, 0.12);
}

&[disabled] .mat-button-focus-overlay {
Expand Down Expand Up @@ -91,16 +91,6 @@
@include _mat-button-ripple-color($theme, default);
}

.mat-button-focus-overlay {
background: map_get($foreground, base);
}

// Note: this needs a bit extra specificity, because we're not guaranteed the inclusion
// order of the theme styles and the button reset may end up resetting this as well.
.mat-stroked-button:not(.mat-button-disabled) {
border-color: mat-color($foreground, divider);
}

.mat-flat-button, .mat-raised-button, .mat-fab, .mat-mini-fab {
// Default font and background color when not using any color palette.
color: mat-color($foreground, text);
Expand Down
9 changes: 7 additions & 2 deletions src/lib/button/button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
// Use the same visual treatment for hover as for focus.
.mat-button:hover .mat-button-focus-overlay,
.mat-stroked-button:hover .mat-button-focus-overlay {
opacity: 0.04;
opacity: 1;
}

// Disable the hover styles on non-hover devices. Since this is more of a progressive
Expand All @@ -38,7 +38,8 @@

.mat-stroked-button {
@include mat-overridable-elevation(0);
border: solid 1px currentColor;

border: 1px solid currentColor;
padding: $mat-stroked-button-padding;
line-height: $mat-stroked-button-line-height;
}
Expand All @@ -65,6 +66,7 @@
height: $mat-icon-button-size;

flex-shrink: 0;

line-height: $mat-icon-button-size;
border-radius: $mat-icon-button-border-radius;

Expand All @@ -91,6 +93,9 @@

// Element that overlays the button to show focus and hover effects.
.mat-button-focus-overlay {
// The button spec calls for focus on raised buttons (and FABs) to be indicated with a
// black, 12% opacity shade over the normal color (for both light and dark themes).
background-color: rgba(black, 0.12);
border-radius: inherit;
opacity: 0;

Expand Down