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

feat(toast): add stacked buttons functionality #26790

Merged
merged 18 commits into from
Feb 15, 2023
Merged

Conversation

liamdebeasi
Copy link
Contributor

@liamdebeasi liamdebeasi commented Feb 13, 2023

Docs PR: ionic-team/ionic-docs#2768

Pull request checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
    • Some docs updates need to be made in the ionic-docs repo, in a separate PR. See the contributing guide for details.
  • Build (npm run build) was run locally and any changes were pushed
  • Lint (npm run lint) has passed locally and any fixes were made for failures

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

Issue URL: Internal ticket

The Material Design guidelines for snackbars/toasts allow for stacked buttons where buttons appear on a separate line: https://m2.material.io/components/snackbars#specs

image

Ionic does not have support for this.

What is the new behavior?

  • Introduces the layout property to ion-toast that allows for content to be stacked.

Note: We investigated handling this automatically with CSS. Here is a sample of handling this with CSS: https://codepen.io/sean-perkins/pen/JjZyvoW. We decided against this approach because it does not allow the default behavior of the message/button appearing on the same line with the message wrapping within its own container. Handling this with CSS means that long message texts always push buttons onto the next line instead instead of having the message wrap within its own container.

Note 2: Using start and end buttons with the stacked layout is an anti-pattern, but I used both in my tests to avoid having duplicate screenshots.

Does this introduce a breaking change?

  • Yes
  • No

Other information

Note on naming: We opted to rename the values from inline and stacked to baseline and stacked to avoid confusion with the inline toast feature where devs can write <ion-toast> instead of using a controller. The "baseline" term is something MD uses in https://material-components.github.io/material-components-web-catalog/#/component/snackbar.

@stackblitz
Copy link

stackblitz bot commented Feb 13, 2023

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 Feb 13, 2023
@liamdebeasi liamdebeasi changed the title Fw 1503 feat(toast): add stacked buttons functionality Feb 13, 2023
@github-actions github-actions bot added the package: vue @ionic/vue package label Feb 13, 2023
@liamdebeasi liamdebeasi marked this pull request as ready for review February 13, 2023 16:43
@liamdebeasi liamdebeasi requested a review from a team as a code owner February 13, 2023 16:43
Copy link
Contributor

@amandaejohnston amandaejohnston left a comment

Choose a reason for hiding this comment

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

Nice work!

@github-actions github-actions bot added package: angular @ionic/angular package package: react @ionic/react package labels Feb 14, 2023
Copy link
Contributor

@sean-perkins sean-perkins left a comment

Choose a reason for hiding this comment

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

Changes look good to me, nice work!

Be aware when we sync this with feature-7.0, we will need to rebuild and update the generated proxies for the Angular package. In v6.x we exclude generating proxies for ion-toast, but in v7 we generate a proxy for the inline usage/type support.

@liamdebeasi liamdebeasi merged commit fc5fcc0 into feature-6.6 Feb 15, 2023
@liamdebeasi liamdebeasi deleted the FW-1503 branch February 15, 2023 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: angular @ionic/angular package package: core @ionic/core package package: react @ionic/react package package: vue @ionic/vue package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants