Skip to content

Commit 0400d81

Browse files
committed
feat(toast): add dismiss method to toast utility
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]>
1 parent 08de3af commit 0400d81

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/app/(app)/(home)/page.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ const Windsock = () => {
336336
})
337337
})
338338

339-
toast('谢谢你!', undefined, {
339+
toast.success('谢谢你!', {
340340
iconElement: (
341341
<m.i
342342
className="i-mingcute-heart-fill text-uk-red-light"

src/lib/toast.ts

+3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const toast = {} as {
3333
info: (message: string, options?: ExternalToast & CustomToastOptions) => void
3434
warn: (message: string, options?: ExternalToast & CustomToastOptions) => void
3535
error: (message: string, options?: ExternalToast & CustomToastOptions) => void
36+
dismiss: (id?: string) => void
3637
}
3738
;['success', 'info', 'warn', 'error'].forEach((type) => {
3839
// @ts-ignore
@@ -68,4 +69,6 @@ const toast = {} as {
6869
}
6970
})
7071

72+
toast.dismiss = sonnerToast.dismiss
73+
7174
export { toast }

0 commit comments

Comments
 (0)