Skip to content

feat(datetime): add part for month/year button - #27618

Merged
liamdebeasi merged 4 commits into
feature-7.1from
FW-3142
Jun 8, 2023
Merged

liamdebeasi merged 4 commits into
feature-7.1from
FW-3142

Conversation

@liamdebeasi

@liamdebeasi liamdebeasi commented Jun 7, 2023 •

Copy link
Copy Markdown
Contributor

Issue number: resolves #26596


What is the current behavior?

There is no way to customize the month/year toggle button using CSS.

What is the new behavior?

  • Adds a Shadow Part to the month/year toggle button.

Does this introduce a breaking change?

  • Yes
  • No

Other information

@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@github-actions github-actions Bot added the package: core @ionic/core package label Jun 7, 2023
:host .calendar-action-buttons ion-item,
:host .calendar-action-buttons ion-button {
color: #{$text-color-step-350};
--color: #{$text-color-step-350};

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Since we are exposing the ion-item instance we should use the public API for setting the color otherwise developers will run into issues changing the color using --color.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Turns out this also fixes a bug where the expanded state of the month/year toggle never changed color! This is why there are screenshot diffs here.

Example: https://ionicframework.com/docs/api/datetime#basic-usage

Switch to MD mode and click the month/year button. Observe that the color of the button only changes to blue when you hover over it. Repeat the same steps on iOS mode. Observe that the color of the button correctly changes to blue regardless of hover state when expanded.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We added this behavior in

:host(.show-month-and-year) .calendar-action-buttons ion-item {
--color: #{current-color(base)};
}
, but since I was setting color directly in the MD stylesheets this color never applied.

@liamdebeasi
liamdebeasi marked this pull request as ready for review June 7, 2023 18:51

@averyrousseau averyrousseau left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM aside from a small description change 👍

Comment on lines +86 to +87
* @part month-year-button - The button that opens the month/year picker when
* using a grid style layout with `presentation="date-time"` or `"time-date"`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The button also appears with presentation="date". It'd probably be better to just say when using a grid style layout, since that covers all relevant presentations.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good call -- fixed in 0ae7407

@liamdebeasi
liamdebeasi merged commit d44422e into feature-7.1 Jun 8, 2023
@liamdebeasi
liamdebeasi deleted the FW-3142 branch June 8, 2023 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: core @ionic/core package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants