Thomas G. Lopes
toasts
5500bfc
raw
history blame contribute delete
702 Bytes
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);
}
// Debugging
// 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",
// });