-
-
Notifications
You must be signed in to change notification settings - Fork 50
Create a toast component #3070
Description
Problem
For many situations we want to display a brief error that appears and either automatically disappears after a timeout, or after the user dismisses it by clicking on it (or an 'x' on it).
We don't have such a widget right now.
Solution
Create a component that supports this with the following features:
- It can be set to be user-dismissible or timeout-dismissible (or both)
- "user-dismissible" means it has an 'x'
- "timeout-dismissible" (default) means there's an inverse progress bar at the bottom of the toast that decreases to the left (and when it reaches 0, the entire toast disappears)
- Important: when the mouse hovers over a
timeout-dismissabletoast, the timer should pause (and resume when the mouse stops hovering over the component)
- Important: when the mouse hovers over a
- It can be positioned relative to some other parent element, with positions: bottom-left, bottom-center, bottom-right, top-left, top-center, top-right
- They can stack on top of one another (when another toast already exists), and they automatically drop downward when a toast below them disappears
- They can have an optional action that's triggered when clicked (via an
sbpInvocation)
Below is a mockup of what these could look like. Obviously these are somewhat ugly and you could do a way better job than me:
These are excellent widgets to display in situations where gi.ui/prompt is too heavy-handed, for example when clicking on a link to a message that was deleted.
Create a gi.ui/toast selector for invoking it easily from anywhere in the app. Similarly to gi.ui/prompt, use named parameters by passing in an object for enhanced code readability.
