Skip to content

Commit

Permalink
feat(button): Add button ripple-states mixin, for simpler customizati…
Browse files Browse the repository at this point in the history
…on of button ripple color.

PiperOrigin-RevId: 310161679
  • Loading branch information
joyzhong authored and copybara-github committed May 6, 2020
1 parent 3846ce3 commit ed7f324
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions packages/mdc-button/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,7 @@ $ripple-target: ".mdc-button__ripple";
@include ripple-mixins.surface($query: $query, $ripple-target: $ripple-target);
@include ripple-mixins.radius-bounded(
$query: $query, $ripple-target: $ripple-target);
@include ripple-mixins.states(
$color: primary, $query: $query, $ripple-target: $ripple-target);
@include ripple-states($color: primary, $query: $query);

#{$ripple-target} {
@include feature-targeting-mixins.targets($feat-structure) {
Expand All @@ -170,24 +169,29 @@ $ripple-target: ".mdc-button__ripple";

.mdc-button--raised,
.mdc-button--unelevated {
@include ripple-mixins.states(
$color: on-primary, $query: $query, $ripple-target: $ripple-target);
@include ripple-states($color: on-primary, $query: $query);
}
}

///
/// Sets ripple color for button.
///
@mixin ripple-states($color, $query: feature-targeting-functions.all()) {
@include ripple-mixins.states(
$color: $color, $query: $query, $ripple-target: $ripple-target);
}

@mixin filled-accessible($container-fill-color, $query: feature-targeting-functions.all()) {
$fill-tone: theme-functions.tone($container-fill-color);

@include container-fill-color($container-fill-color, $query);

@if ($fill-tone == "dark") {
@include ink-color(text-primary-on-dark, $query);
@include ripple-mixins.states(
$color: text-primary-on-dark, $query: $query, $ripple-target: $ripple-target);
@include ripple-states($color: text-primary-on-dark, $query: $query);
} @else {
@include ink-color(text-primary-on-light, $query);
@include ripple-mixins.states(
$color: text-primary-on-light, $query: $query, $ripple-target: $ripple-target);
@include ripple-states($color: text-primary-on-light, $query: $query);
}
}

Expand Down

0 comments on commit ed7f324

Please sign in to comment.