Skip to content

Commit 54df3a8

Browse files
committed
fix(material-experimental/mdc-button): fix icon styling and add example
1 parent 13ccd65 commit 54df3a8

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

src/dev-app/mdc-button/mdc-button-demo.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,11 @@ <h4 class="demo-section-header">Extended Fab Buttons</h4>
165165
<mat-icon>home</mat-icon>
166166
Extended
167167
</button>
168+
<button mat-fab [extended]="true">
169+
<mat-icon>home</mat-icon>
170+
Extended
171+
<mat-icon iconPositionEnd>favorite</mat-icon>
172+
</button>
168173
</section>
169174

170175
<h4 class="demo-section-header"> Mini Fab Buttons [mat-mini-fab]</h4>

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

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@import '@material/fab/mixins.import';
2+
@import '@material/fab/variables.import';
23
@import '@material/button/variables.import';
34
@import '@material/theme/variables.import';
45
@import '../mdc-helpers/mdc-helpers';
@@ -22,11 +23,27 @@
2223
// <span class="mdc-fab__icon material-icons">favorite</span>
2324
// ```
2425
// However, Angular Material expects a `mat-icon` instead. The following
25-
// will extend the `mdc-fab__icon` styling to the mat icon. Note that
26-
// the extended styles inherently only match icons that nest themselves in
27-
// a parent `mdc-fab`.
26+
// mixin will style the icons appropriately.
2827
.mat-icon {
29-
@extend .mdc-fab__icon;
28+
@include mdc-fab-icon_();
29+
}
30+
}
31+
32+
.mat-mdc-extended-fab {
33+
@include mdc-fab-extended_();
34+
35+
.mat-icon {
36+
@include mdc-fab-extended-icon-padding($mdc-fab-extended-icon-padding, $mdc-fab-extended-label-padding);
37+
}
38+
39+
// For Extended FAB with text label followed by icon.
40+
// We are checking for the a button class because white this is a FAB it uses the same template as button.
41+
.mdc-button__label + .mat-icon {
42+
@include mdc-fab-extended-icon-padding(
43+
$mdc-fab-extended-icon-padding,
44+
$mdc-fab-extended-label-padding,
45+
$is-icon-at-end: true
46+
);
3047
}
3148
}
3249

0 commit comments

Comments
 (0)