Add notification UI #449
Reference in New Issue
Block a user
Delete Branch "feature/notifcation-ui"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Resolves #447
/claim #447
This approach uses a simple stimulus controller to remove the element after the animation has completed.
Notifications can be generated by simply rendering a notification helper anywhere within the application, this could be in a view, as a turbo stream response, or over a turbo stream subscription. By default Rails flash messages types are mapped to notification types, icons for additional types can easily be added in future.
It supports multiple notifications at once, by stacking them in a notification-tray element.
The video below demonstrates the default flash messages in action, and then I update the code to force some hardcoded notifications where the type is passed as error or success.
https://github.com/maybe-finance/maybe/assets/1793797/a17f7e7f-e647-4250-b64e-bb3964cdda81
The circle is animated with CSS also using an SVG animation stroke fill animation technique (https://css-tricks.com/svg-line-animation-works/)
@JoshAntBrown Overall like your solution. However, it's missing appropriate icons (check/x).
@Shpigford Ah they should be there! Check and X icons appear later in the video, and are only rendered when notification helper is passed the type as success, or error.
When given a different type, or none at all then the notification renders without a type.
I can make the check a default if prefered?
@JoshAntBrown default would be great.
Done! You'll get a check by default regardless of type now unless you pass type as "alert" or "error".
Amazing. Works beautifully. Thank you!
Ah, perfect! Thanks 😄