-
Notifications
You must be signed in to change notification settings - Fork 29
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
Allow multiple instances of toast group #24
base: master
Are you sure you want to change the base?
Allow multiple instances of toast group #24
Conversation
<div id={assigns[:id] || "toast-group"} class={@group_class_fn.(assigns)}> | ||
<div class="contents" id="toast-group-stream" phx-update="stream"> | ||
<div id={@id} class={@group_class_fn.(assigns)}> | ||
<div class="contents" id={@id <> "-stream"} phx-update="stream" data-role="toast-group-stream"> |
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 is the important bit.
Without being able to change this HTML ID, we get duplicate HTML IDs when we have 2 toast groups rendered, e.g. when doing live_render
@srcrip Let me know if this PR needs anything, please. |
Thank you @peaceful-james! A couple thoughts:
I'm not against merging this per se with some of those things addressed but I'm also curious what your use case is. Why exactly do you want to have it show up multiple times? And in your testing did this actually work properly with the state management that happens on the javascript side of the library? |
I will address these comments probably no sooner than Jan 25th. Yes, it worked in my testing. Example usage: a |
Just tweaks an HTML ID and adds conditional flash rendering.
This affords using toast group in
live_render
.I also snuck in some cheeky
data-role
attributes for easier testing and CSS hacking.