|
| 1 | +@use '@material/button/button'; |
| 2 | + |
1 | 3 | @import '@material/button/mixins.import'; |
2 | 4 | @import '@material/button/variables.import'; |
3 | 5 | @import '@material/ripple/mixins.import'; |
|
10 | 12 | .mat-mdc-button, .mat-mdc-unelevated-button, .mat-mdc-raised-button, .mat-mdc-outlined-button { |
11 | 13 | @include mat-private-button-interactive(); |
12 | 14 | @include mat-private-button-disabled(); |
| 15 | +} |
| 16 | + |
| 17 | +// MDC expects button icons to contain this HTML content: |
| 18 | +// ```html |
| 19 | +// <span class="mdc-button__icon material-icons">favorite</span> |
| 20 | +// ``` |
| 21 | +// However, Angular Material expects a `mat-icon` instead. The following |
| 22 | +// mixins will style the icons appropriately. |
| 23 | +.mat-mdc-button { |
| 24 | + .mat-icon { |
| 25 | + @include button.icon(); |
| 26 | + } |
| 27 | + .mdc-button__label + .mat-icon { |
| 28 | + @include button.icon-trailing(); |
| 29 | + } |
| 30 | +} |
13 | 31 |
|
14 | | - // MDC expects button icons to contain this HTML content: |
15 | | - // ```html |
16 | | - // <span class="mdc-button__icon material-icons">favorite</span> |
17 | | - // ``` |
18 | | - // However, Angular Material expects a `mat-icon` instead. The following |
19 | | - // will extend the `mdc-button__icon` styling to the mat icon. Note that |
20 | | - // the extended styles inherently only match icons that nest themselves in |
21 | | - // a parent `mdc-button`. |
22 | | - // |
23 | | - // TODO(mmalerba): Have MDC create a mixin for this so we don't have to rely on extending their |
24 | | - // class. |
| 32 | +.mat-mdc-unelevated-button, .mat-mdc-raised-button, .mat-mdc-outlined-button { |
| 33 | + // Icons inside contained buttons have different styles due to increased button padding |
25 | 34 | .mat-icon { |
26 | | - @extend .mdc-button__icon; |
| 35 | + @include button.icon(); |
| 36 | + @include button.icon-contained(); |
| 37 | + } |
| 38 | + |
| 39 | + .mdc-button__label + .mat-icon { |
| 40 | + @include button.icon-contained-trailing(); |
27 | 41 | } |
28 | 42 | } |
29 | 43 |
|
|
0 commit comments