-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
feat(toast): add global publisher #177
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
5736c86
to
8d9b488
Compare
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.
Awesome job. A single use toast 😍
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.
Awesome PR!
I would have never thought of being so modular. I have a lot to learn from you. :)
const toggleToast = (value: boolean, index: number) => { | ||
setToasts((toasts) => | ||
toasts.map((toast, i) => { | ||
if (i === index) { | ||
toast.open = value; | ||
} | ||
return toast; | ||
}) | ||
); | ||
}; | ||
|
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.
Can you update toggleToast
function to use the id of the toasts instead of index?
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.
Oow ! Thanks Man 😄
Fixed it here: #178
Description
This PR enhances the toast system by refactoring it and introduces the use of context to incorporate a global notification publisher.
Checklist before requesting a review
Please delete options that are not relevant.
Screenshots (if appropriate):