-
Notifications
You must be signed in to change notification settings - Fork 6.8k
feat(material-experimental/mdc-button): add extended fab #21585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I still need to fix the unit tests but wanted to see if the inputs/classes should be added this way |
@@ -49,6 +52,8 @@ export class MatFabButton extends MatButtonBase { | |||
// The FAB by default has its color set to accent. | |||
color = 'accent' as ThemePalette; | |||
|
|||
extended: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is "extended" the only variation or do we expect more? If we expect more, we can turn it into a string instead, e.g. appearance: 'extended'
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be the only variation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you make this a setter/getter and use coerceBooleanInput
that way peopel can do <button mat-fab extended>
instead of <button mat-fab [extended]="true">
(coerceBooleanInput
does some non-standard type coercion, e.g. '' => true
)
Addressed comments and split up mat-fab and mat-mini-fab since the |
// expect(extendedFabButtonDebugEl.nativeElement.classList) | ||
// .toContain('mat-accent', 'Expected extended fab buttons to use accent palette by default'); | ||
// }); | ||
// }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented block?
@@ -49,27 +63,76 @@ export class MatFabButton extends MatButtonBase { | |||
// The FAB by default has its color set to accent. | |||
color = 'accent' as ThemePalette; | |||
|
|||
private _extended: boolean; | |||
get extended() { return this._extended; } | |||
set extended(extended: any) { this._extended = coerceBooleanProperty(extended); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type here should still be boolean, but the class should define an ngAcceptInputType
to BooleanInput
(search for other ngAcceptInputType
instances for examples)
*/ | ||
@Component({ | ||
selector: `button[mat-mini-fab]`, | ||
templateUrl: 'button.html', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, a thought occurred to me that having multiple components with the same template would lead to duplicate generated code. I checked with Andrew K, and he confirmed. So, rather than introducing a separate component with the same template, we should probably try to have one class with the templateUrl
as the base class and then extend all the other buttons from it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe all buttons extend MatButtonBase with the same template (and anchos MatAnchorBase). Should there be another MatFabBase?
1afd252
to
23caa44
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -78,9 +141,39 @@ export class MatFabAnchor extends MatAnchor { | |||
// The FAB by default has its color set to accent. | |||
color = 'accent' as ThemePalette; | |||
|
|||
extended: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one too
* feat(material-experimental/mdc-button): add extended fab * fix(material-experimental/mdc-button): split up fab and mini fab * fix(material-experimental/mdc-button): fix icon styling and add example * fix(material-experimental/mdc-button): add getter/setter for extended property (cherry picked from commit f7ace54)
* feat(material-experimental/mdc-button): add extended fab * fix(material-experimental/mdc-button): split up fab and mini fab * fix(material-experimental/mdc-button): fix icon styling and add example * fix(material-experimental/mdc-button): add getter/setter for extended property (cherry picked from commit f7ace54)
* feat(material-experimental/mdc-button): add extended fab * fix(material-experimental/mdc-button): split up fab and mini fab * fix(material-experimental/mdc-button): fix icon styling and add example * fix(material-experimental/mdc-button): add getter/setter for extended property
* feat(material-experimental/mdc-button): add extended fab * fix(material-experimental/mdc-button): split up fab and mini fab * fix(material-experimental/mdc-button): fix icon styling and add example * fix(material-experimental/mdc-button): add getter/setter for extended property
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Add extended FAB to align with MDC https://material.io/components/buttons-floating-action-button#extended-fab