Skip to content

Commit 46e2cbb

Browse files
committed
revised based on reviews
1 parent d28bc79 commit 46e2cbb

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

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

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
mixinDisableRipple,
2121
RippleAnimationConfig
2222
} from '@angular/material/core';
23+
import {MDCRippleFoundation} from '@material/ripple';
2324

2425
/** Inputs common to all buttons. */
2526
export const MAT_BUTTON_INPUTS = ['disabled', 'disableRipple', 'color'];
@@ -75,13 +76,10 @@ export const _MatButtonBaseMixin: CanDisableRippleCtor&CanDisableCtor&CanColorCt
7576
/** Base class for all buttons. */
7677
export class MatButtonBase extends _MatButtonBaseMixin implements CanDisable, CanColor,
7778
CanDisableRipple {
78-
rippleAnimation: RippleAnimationConfig = {
79-
// TODO(mmalerba): Use the MDC constants once they are exported separately from the
80-
// foundation. Grabbing them off the foundation prevents the foundation class from being
81-
// tree-shaken. There is an open PR for this:
82-
// https://github.com/material-components/material-components-web/pull/4593
83-
enterDuration: 225 /* MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS */,
84-
exitDuration: 150 /* MDCRippleFoundation.numbers.FG_DEACTIVATION_MS */,
79+
/** The ripple animation configuration to use for the buttons. */
80+
_rippleAnimation: RippleAnimationConfig = {
81+
enterDuration: MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS,
82+
exitDuration: MDCRippleFoundation.numbers.FG_DEACTIVATION_MS
8583
};
8684

8785
/** Whether the ripple is centered on the button. */
@@ -111,10 +109,6 @@ export class MatButtonBase extends _MatButtonBaseMixin implements CanDisable, Ca
111109
return attributes.some(attribute => this._elementRef.nativeElement.hasAttribute(attribute));
112110
}
113111

114-
_getHostElement() {
115-
return this._elementRef.nativeElement;
116-
}
117-
118112
_isRippleDisabled() {
119113
return this.disableRipple || this.disabled;
120114
}

src/material-experimental/mdc-button/button.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</ng-content>
88

99
<div matRipple class="mat-button-ripple"
10-
[matRippleAnimation]="rippleAnimation"
10+
[matRippleAnimation]="_rippleAnimation"
1111
[matRippleDisabled]="_isRippleDisabled()"
1212
[matRippleCentered]="isRippleCentered"
13-
[matRippleTrigger]="_getHostElement()"></div>
13+
[matRippleTrigger]="_elementRef.nativeElement"></div>

0 commit comments

Comments
 (0)