-
Notifications
You must be signed in to change notification settings - Fork 146
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 #5063
feat: toast #5063
Conversation
src/app/pages/send/send-crypto-asset-form/family/bitcoin/hooks/use-send-max.tsx
Show resolved
Hide resolved
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.
Nice work @fbwoolf . I tested this and its working well and cleaner than the previous implementation. I think it's a good idea to use as much styled primitives as we can to keep our library consistent
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.
Nice improvement.
Must admit I preferred the API of react-hot-toast, was nice being able to trigger it outside a react context. All good removing it though.
Appreciate the separation you've gone for putting the global provider level code in a feature, and only the dumb components in the ui folder.
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.
Looking great @fbwoolf!
Not a blocker, but maybe s.th. we can look into later: I think the tick animation for the success toast was a nice touch, would be nice if we can bring it back.
@markmhendrickson It's actually supposed to alway appear on top |
Thanks, got it. @fbwoolf could we do a general audit of placement as part of this work stream or a new separate issue? |
The changes here position it only at the top for all instances. It was refactored based on the design spec which only positioned the toast now at the top center. |
Do you mean with the old checkmark icon? This is the old one to ref: https://github.com/timolins/react-hot-toast/blob/main/src/components/checkmark.tsx |
87a0275
to
fc4e2be
Compare
This PR implements a new
Toast
using a Radix primitive and a reference implementation from them to manage toast notifications: example codesandboxI am proposing here we abandon
react-hot-toast
bc the library is outdated, ref their Github repo here. There are lots of outstanding issues and only one commit in 2024.The Radix implementation, using React Context, allowed me to simply swap out our current implementation with a new context hook,
toast = useToast()
. As an example, our implementation is still,toast.success('Message')
. The context also includes:info
,error
, andpromise
. The implementation here allows multiple toasts to occur, but we can customize that if we want. There is a lot we can do with this in the future.The only place I wasn't able to use the hook was in the debug code, but I don't think it is necessary to show a toast there bc a user is already in the console. I switched that one to a logger message.
Stories included...