ui icon indicating copy to clipboard operation
ui copied to clipboard

feat(toast): add example of promise toast and add shake animation

Open juliusmarminge opened this issue 2 years ago • 6 comments

Thought I'd add an example of a promise-based toaster.

Adds a shake animation if a toast is updated to destructive:

https://user-images.githubusercontent.com/51714798/232233219-2fc00303-2a31-4546-a4d9-17b790f2dfc4.mp4

juliusmarminge avatar Apr 15 '23 12:04 juliusmarminge

@juliusmarminge is attempting to deploy a commit to the shadcn-pro Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Apr 15 '23 12:04 vercel[bot]

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
next-template ⬜️ Ignored (Inspect) Apr 15, 2023 3:52pm

vercel[bot] avatar Apr 15 '23 15:04 vercel[bot]

cc @shadcn is this something you're interested in?

juliusmarminge avatar Apr 17 '23 16:04 juliusmarminge

@juliusmarminge Sorry been busy with the update. I can come back to this now.

This looks good. Let's think a bit about the API. I'm wondering if we could do something like:

const progress = toast({
  title: "Sending...",
  description: "Your message is being sent.",
})

toast.animate() // Using .animate for lack of better term here.

Then based on some data-animating props, we could add animation via Tailwind.

This way we can support all the default tailwind animation classes, animate-pulse, animate-bounce..etc and also allow custom animations as well.

What do you think?

shadcn avatar Apr 20 '23 12:04 shadcn

@juliusmarminge is this something y'all are still working on?

Hidde-Heijnen avatar May 20 '23 14:05 Hidde-Heijnen

I can pick it up after exams are over. But if you're down to continue now feel free!

juliusmarminge avatar May 20 '23 15:05 juliusmarminge

not needed now with sonner i guess

juliusmarminge avatar Dec 23 '23 11:12 juliusmarminge