Skip to content

Commit 979f321

Browse files
authored
feat(material-experimental/mdc-button): support primary/accent/warn (#16782)
1 parent 3857ab2 commit 979f321

File tree

2 files changed

+61
-1
lines changed

2 files changed

+61
-1
lines changed

src/material-experimental/mdc-button/_mdc-button.scss

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,41 @@
55

66
@mixin mat-button-theme-mdc($theme) {
77
@include mat-using-mdc-theme($theme) {
8+
.mat-mdc-button {
9+
&.mat-accent {
10+
@include mdc-button-ink-color(secondary, $query: $mat-theme-styles-query);
11+
}
12+
13+
&.mat-warn {
14+
@include mdc-button-ink-color(error, $query: $mat-theme-styles-query);
15+
}
16+
}
17+
18+
.mat-mdc-raised-button,
19+
.mat-mdc-unelevated-button {
20+
&.mat-accent {
21+
@include mdc-button-container-fill-color(secondary, $query: $mat-theme-styles-query);
22+
@include mdc-button-ink-color(on-secondary, $query: $mat-theme-styles-query);
23+
}
24+
25+
&.mat-warn {
26+
@include mdc-button-container-fill-color(error, $query: $mat-theme-styles-query);
27+
@include mdc-button-ink-color(on-error, $query: $mat-theme-styles-query);
28+
}
29+
}
30+
31+
.mat-mdc-outlined-button {
32+
&.mat-accent {
33+
@include mdc-button-outline-color(secondary, $query: $mat-theme-styles-query);
34+
@include mdc-button-ink-color(secondary, $query: $mat-theme-styles-query);
35+
}
36+
37+
&.mat-warn {
38+
@include mdc-button-outline-color(error, $query: $mat-theme-styles-query);
39+
@include mdc-button-ink-color(error, $query: $mat-theme-styles-query);
40+
}
41+
}
42+
843
@include mdc-button-without-ripple($query: $mat-theme-styles-query);
944
}
1045
}
@@ -17,6 +52,18 @@
1752

1853
@mixin mat-fab-theme-mdc($theme) {
1954
@include mat-using-mdc-theme($theme) {
55+
.mat-mdc-fab, .mat-mdc-mini-fab {
56+
&.mat-primary {
57+
@include mdc-fab-container-color(primary, $query: $mat-theme-styles-query);
58+
@include mdc-fab-ink-color(on-primary, $query: $mat-theme-styles-query);
59+
}
60+
61+
&.mat-warn {
62+
@include mdc-fab-container-color(error, $query: $mat-theme-styles-query);
63+
@include mdc-fab-ink-color(on-error, $query: $mat-theme-styles-query);
64+
}
65+
}
66+
2067
@include mdc-fab-without-ripple($query: $mat-theme-styles-query);
2168
}
2269
}
@@ -29,6 +76,20 @@
2976

3077
@mixin mat-icon-button-theme-mdc($theme) {
3178
@include mat-using-mdc-theme($theme) {
79+
.mat-mdc-icon-button {
80+
&.mat-primary {
81+
@include mdc-icon-button-ink-color(primary, $query: $mat-theme-styles-query);
82+
}
83+
84+
&.mat-accent {
85+
@include mdc-icon-button-ink-color(secondary, $query: $mat-theme-styles-query);
86+
}
87+
88+
&.mat-warn {
89+
@include mdc-icon-button-ink-color(error, $query: $mat-theme-styles-query);
90+
}
91+
}
92+
3293
@include mdc-icon-button-without-ripple($query: $mat-theme-styles-query);
3394
}
3495
}

src/material-experimental/mdc-button/button-base.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ export const MAT_BUTTON_INPUTS = ['disabled', 'disableRipple', 'color'];
2727

2828
/** Shared host configuration for all buttons */
2929
export const MAT_BUTTON_HOST = {
30-
'class': 'mat-mdc-button',
3130
'[attr.disabled]': 'disabled || null',
3231
'[class._mat-animation-noopable]': '_animationMode === "NoopAnimations"',
3332
};

0 commit comments

Comments
 (0)