Skip to content

Commit

Permalink
fix(material-experimental/mdc-button): add mdc ripple class for fab
Browse files Browse the repository at this point in the history
  • Loading branch information
annieyw committed Feb 25, 2021
1 parent 3db90f6 commit 2cfe355
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/material-experimental/mdc-button/button-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ export class MatButtonBase extends _MatButtonBaseMixin implements CanDisable, Ca
/** Whether the ripple is centered on the button. */
_isRippleCentered = false;

/** Whether this button is a FAB. Used to apply the correct class on the ripple. */
_isFab = false;

/** Reference to the MatRipple instance of the button. */
@ViewChild(MatRipple) ripple: MatRipple;

Expand Down
4 changes: 3 additions & 1 deletion src/material-experimental/mdc-button/button.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<span class="mdc-button__ripple"></span>
<span
[class.mdc-button__ripple]="!_isFab"
[class.mdc-fab__ripple]="_isFab"></span>

<ng-content select=".material-icons:not([iconPositionEnd]), mat-icon:not([iconPositionEnd])">
</ng-content>
Expand Down
4 changes: 4 additions & 0 deletions src/material-experimental/mdc-button/fab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ export class MatFabButton extends MatButtonBase {
// The FAB by default has its color set to accent.
color = 'accent' as ThemePalette;

_isFab = true;

private _extended: boolean;
get extended(): boolean { return this._extended; }
set extended(value: boolean) { this._extended = coerceBooleanProperty(value); }
Expand Down Expand Up @@ -95,6 +97,8 @@ export class MatMiniFabButton extends MatButtonBase {
// The FAB by default has its color set to accent.
color = 'accent' as ThemePalette;

_isFab = true;

constructor(
elementRef: ElementRef, platform: Platform, ngZone: NgZone,
@Optional() @Inject(ANIMATION_MODULE_TYPE) animationMode?: string) {
Expand Down

0 comments on commit 2cfe355

Please sign in to comment.