Allow multiple instances of toast group#24
Allow multiple instances of toast group#24peaceful-james wants to merge 7 commits intosrcrip:masterfrom
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.
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 |
|
Closing for now as it appears to be stale but feel free to reopen! |
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-roleattributes for easier testing and CSS hacking.