Skip to content
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

fix(datepicker): refactor datepicker toggle to support theming #5317

Merged
merged 4 commits into from Jul 31, 2017

Conversation

mmalerba
Copy link
Contributor

@mmalerba mmalerba commented Jun 22, 2017

@jelbourn The md-datepicker-toggle-icon could easily be replaced with an md-icon the only reason it's separate is so users don't need to load a font to use it. Would it be better to have datepicker module register an svg set with just a 'material:datepicker:toggle' icon for now? Other components could create similar sets if they need to include icons.

BREAKING CHANGE: [mdDatepickerToggle] attribute has been changed to md-datepicker-toggle element

fixes #5224
fixes #4934
fixes #4684

@mmalerba mmalerba requested a review from jelbourn June 22, 2017 23:38
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jun 22, 2017
_isButton = false;

constructor(elementRef: ElementRef, public _intl: MdDatepickerIntl) {
this._isButton = elementRef.nativeElement.tagName.toLowerCase() === 'button';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe can be:

elementRef.nativeElement instanceof HTMLButtonElement;

@yogeshgadge
Copy link

yogeshgadge commented Jun 26, 2017

@mmalerba Wondering how does one use Fontawesome icon for md-datepicker-toggle-icon ?

@mmalerba
Copy link
Contributor Author

@yogeshgadge just use a normal md-icon, md-datepicker-toggle-icon only exists so we can ship a default icon without having to require a whole CSS font library

@jelbourn
Copy link
Member

FYI there's already 9 uses of this inside Google we'd have to update

<button mdSuffix [mdDatepickerToggle]="minDatePicker"></button>
<button md-icon-button mdSuffix [mdDatepickerToggle]="minDatePicker">
<md-datepicker-toggle-icon></md-datepicker-toggle-icon>
</button>
Copy link
Member

@jelbourn jelbourn Jun 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think of just having

<!-- Icon is baked into this -->
<md-datepicker-toggle for="minDatePicker"></md-datepicker-toggle>

If someone wants to have a custom icon, they just do a custom <button> with the close behavior. [mdDatepickerToggle]="minDatePicker" is longer than (click)="minDatePicker.toggle()", so it seems like there's not much sense in breaking up the toggle behavior and the baked-in icon.

For the baked-in version, all the things someone would typically want to set on the native <button> are taken care of by the component (content, aria-label, and type).

@mmalerba
Copy link
Contributor Author

Changed to suggested API, PTAL

Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just needs rebase

@mmalerba mmalerba added action: merge The PR is ready for merge by the caretaker and removed pr: needs rebase labels Jul 10, 2017
@mmalerba mmalerba changed the title fix(datepicker): refactor datepicker toggle to support themeing and combination with button directives fix(datepicker): refactor datepicker toggle to support themeing Jul 13, 2017
@kara kara changed the title fix(datepicker): refactor datepicker toggle to support themeing fix(datepicker): refactor datepicker toggle to support theming Jul 20, 2017
@kara kara added the presubmit failures This PR has failures in Google's internal presubmit process and cannot be immediately merged label Jul 20, 2017
@andrewseguin
Copy link
Contributor

Can you try rebasing? Github doesnt say anything but our script does

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement presubmit failures This PR has failures in Google's internal presubmit process and cannot be immediately merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Time Picker Change color of datetimepicker toggle Apply md-button to datePicker Button
8 participants