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/issue 9 #28

Merged
merged 3 commits into from
Dec 7, 2024
Merged

Fix/issue 9 #28

merged 3 commits into from
Dec 7, 2024

Conversation

shhdharmen
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our guidelines: CONTRIBUTING.md#commit
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

Issue Number: #9

What is the new behavior?

  • Fixes grouping
  • Introduces new builder pattern to achieve pre-grouping
    const parentBuilder = new HotToastBuilder(ngTemplateGroup, toast)
    .setOptions({
      position: 'top-right',
      autoClose: false,
      className: 'hot-toast-custom-class',
      group: {
        className: 'hot-toast-custom-class'
      }
    });
    
    // Create child toasts
    const children = childNotifications(ngTemplateGroupItem).map((child) => {
      return new HotToastBuilder(child.options.message, toast)
        .setOptions(child.options);
    });
    
    // Add children to parent
    children.forEach((child) => parentBuilder.addChild(child));
    
    // Create the toast with all children (but don't show yet)
    const parentRef = parentBuilder.create();
    
    // Once all refs are attached, show the parent toast
    parentRef.afterGroupRefsAttached.subscribe(() => {
      parentRef.show();
    });

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

`// Create parent toastconst parent = new HotToastBuilder(template, toast)  .setOptions({
position: 'top-right',    className: 'custom-class'  });// Add childrennotifications.map(n =>   new
HotToastBuilder(n.message, toast)    .setOptions(n.options)).forEach(child =>
parent.addChild(child));// Create and show when readyconst ref =
parent.create();ref.afterGroupRefsAttached.subscribe(() => ref.show());`

fix #9
@shhdharmen shhdharmen merged commit 8ffc08e into beta Dec 7, 2024
1 check passed
@shhdharmen shhdharmen deleted the fix/issue-9 branch December 7, 2024 08:49
@shhdharmen
Copy link
Contributor Author

🎉 This PR is included in version 3.1.0-beta.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Copy link

🎉 This PR is included in version 3.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant