Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Commit

Permalink
feat(button): Move disabled style into private base mixin (#1255)
Browse files Browse the repository at this point in the history
  • Loading branch information
yeelan0319 authored Sep 8, 2017
1 parent 5266776 commit 2336128
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 38 deletions.
29 changes: 29 additions & 0 deletions packages/mdc-button/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,37 @@
}

&:disabled {
@include mdc-theme-prop(background-color, transparent);
@include mdc-theme-prop(color, text-disabled-on-light);

cursor: default;
pointer-events: none;

@include mdc-theme-dark(".mdc-button") {
@include mdc-theme-prop(color, text-disabled-on-dark);
}
}
}

@mixin mdc-button--stroked_() {
&:disabled {
@include mdc-theme-prop(border-color, text-disabled-on-light);

@include mdc-theme-dark(".mdc-button") {
@include mdc-theme-prop(border-color, text-disabled-on-dark);
}
}
}

@mixin mdc-button--filled_() {
&:disabled {
@include mdc-theme-prop(background-color, rgba(black, .12));
@include mdc-theme-prop(color, text-disabled-on-light);

@include mdc-theme-dark(".mdc-button") {
@include mdc-theme-prop(background-color, rgba(white, .12));
@include mdc-theme-prop(color, text-disabled-on-light);
}
}
}

Expand Down
40 changes: 2 additions & 38 deletions packages/mdc-button/mdc-button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

.mdc-button--raised,
.mdc-button--unelevated {
@include mdc-button--filled_;
@include mdc-button-container-fill-color(black);
@include mdc-button-ink-color(text-primary-on-dark);
@include mdc-button-ripple((base-color: white, opacity: .32));
Expand All @@ -53,6 +54,7 @@
}

.mdc-button--stroked {
@include mdc-button--stroked_;
@include mdc-button-stroke-width(2px);
@include mdc-button-stroke-style(solid);
@include mdc-button-stroke-color(text-primary-on-light);
Expand Down Expand Up @@ -116,42 +118,4 @@
}
}
}

// Disabled button styles need to be last to ensure they override other primary/accent/dark styles

.mdc-button {
&:disabled {
background-color: transparent;
color: rgba(black, .38);

@include mdc-theme-dark(".mdc-button") {
@include mdc-theme-prop(color, text-disabled-on-dark);
}
}
}

.mdc-button--raised,
.mdc-button--unelevated {
&:disabled {
@include mdc-theme-prop(color, text-primary-on-dark);

background-color: rgba(black, .15);

@include mdc-theme-dark(".mdc-button") {
@include mdc-theme-prop(color, text-disabled-on-dark);

background-color: rgba(255, 255, 255, .15);
}
}
}

.mdc-button--stroked {
&:disabled {
border-color: rgba(black, .38);

@include mdc-theme-dark(".mdc-button") {
@include mdc-theme-prop(border-color, text-disabled-on-dark);
}
}
}
// postcss-bem-linter: end

0 comments on commit 2336128

Please sign in to comment.