File size: 637 Bytes
a5619c2
3df1e9f
 
 
 
 
 
 
22dad9f
 
19d1d46
22dad9f
3df1e9f
e48cc8b
 
3df1e9f
 
 
 
 
19d1d46
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { Toaster } from "melt/builders";

export type ToastData = {
	title: string;
	description: string;
	variant: "success" | "warning" | "error";
};

export const toaster = new Toaster<ToastData>({
	hover: "pause-all",
	closeDelay: 0,
});

export function addToast(data: ToastData) {
	toaster.addToast({ data });
}

export function removeToast(id: string) {
	toaster.removeToast(id);
}

addToast({
	title: "Hello World 1",
	description: "hey",
	variant: "success",
});

addToast({
	title: "Hello World 2",
	description: "hey",
	variant: "success",
});

addToast({
	title: "Hello World 3",
	description: "hi",
	variant: "success",
});