You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a first version of a NotificationManager component using Sonner.
Objectives
Have a first working version of a Notification Manager
Validate our below considerations and assumptions on using Sonner as a basis for our notification system as a basis for an informed decision whether to move on with Sonner or not
Considerations And Assumptions
The current general assumption is we can wrap Sonner and let it do most of the heavy lifting, but can add functionality that is specific to Juno and our needs in terms of customization.
We create a NotificationManager component that wraps Sonner
Our API receives and forwards props to Sonner
Our API may recieve additional props that we control/manage
We can use our own Toast component instead of Sonner's inbuilt ones and pass our component to Sonner to render (There is also a headless mode in Sonner that may be working as an alternative: Sonner documentation - Styling
We control the DOM mount point where we let Sonner render our Toast notifications, so we can guarantee notifications always render on top of other content (that may be rendered in a portal using PortalProvider already.
We can render semantic notifications according to Juno semantics
We can render dismissable and non-dismissable (timed) notifications
We can customize the duration of a notification
We can show multiple notifications with identical or overlapping durations
We can handle (or at least have an idea and a technical concept) for handling "overflow" situations when there are more notifications visible at a single point in time than fit on the current screen
We have event handlers that fire when a) a notification is shown, and b) a notification is dismissed or disappears
We can target any existing message in order to update/delete it
Implementation Tasks/Notes
Define a mount point / second portal root that we exclusively use to render notifications after our universal portal root in AppShell
Validate whether we can use our existing PortalProvider to render this mount point, too (we have only ever used a single instance so we should validate there are no conflicts or undesirable side effects)
Map existing props of Toast to Sonner props, define API in detail incl. sensible/opinionated defaults
When NotificationManager manages the full lifecycle of each notification, we can and should remove the (rudimentary) lifecycle props and logic inside Toast. Toast should become a fully logic-less component when using NotificationManager.
Out Of Scope
Notification history / storing notifications beyond their expiry
WIP
Task Description
Create a first version of a
NotificationManagercomponent using Sonner.Objectives
Considerations And Assumptions
The current general assumption is we can wrap Sonner and let it do most of the heavy lifting, but can add functionality that is specific to Juno and our needs in terms of customization.
NotificationManagercomponent that wraps Sonnerheadlessmode in Sonner that may be working as an alternative: Sonner documentation - StylingPortalProvideralready.Implementation Tasks/Notes
AppShellPortalProviderto render this mount point, too (we have only ever used a single instance so we should validate there are no conflicts or undesirable side effects)Toastto Sonner props, define API in detail incl. sensible/opinionated defaultsNotificationManagermanages the full lifecycle of each notification, we can and should remove the (rudimentary) lifecycle props and logic insideToast.Toastshould become a fully logic-less component when usingNotificationManager.Out Of Scope
Additional Information And Resources