Skip to content

Commit

Permalink
feat(toast): add dismiss method to toast utility
Browse files Browse the repository at this point in the history
Extends the toast utility with a dismiss method from sonner, complementing the previous refactoring to use sonner for toast notifications

Signed-off-by: Innei <[email protected]>
  • Loading branch information
Innei committed Feb 2, 2025
1 parent 08de3af commit 0400d81
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/app/(app)/(home)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ const Windsock = () => {
})
})

toast('谢谢你!', undefined, {
toast.success('谢谢你!', {
iconElement: (
<m.i
className="i-mingcute-heart-fill text-uk-red-light"
Expand Down
3 changes: 3 additions & 0 deletions src/lib/toast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const toast = {} as {
info: (message: string, options?: ExternalToast & CustomToastOptions) => void
warn: (message: string, options?: ExternalToast & CustomToastOptions) => void
error: (message: string, options?: ExternalToast & CustomToastOptions) => void
dismiss: (id?: string) => void
}
;['success', 'info', 'warn', 'error'].forEach((type) => {
// @ts-ignore
Expand Down Expand Up @@ -68,4 +69,6 @@ const toast = {} as {
}
})

toast.dismiss = sonnerToast.dismiss

export { toast }

0 comments on commit 0400d81

Please sign in to comment.