nebula2 / src /utils /toast.ts
soiz1's picture
Upload folder using huggingface_hub
01fcadf verified
raw
history blame contribute delete
772 Bytes
type ToastType = "success" | "error" | "multiline";
type Position =
| "top-left"
| "top-middle"
| "top-right"
| "bottom-left"
| "bottom-right"
| "bottom-center";
interface Props {
toastType: ToastType;
text: string;
class: string;
id?: string;
duration?: number;
emoji?: any;
position?: Position;
}
function toast(query: string) {
const wrapper = document.getElementById("toastwrapper") as HTMLDivElement;
wrapper.classList.remove("hidden");
//this is a really hacky solution for toast notifications LOL
const element = document.querySelector(query) as HTMLElement;
//click the element
element.click();
}
export { type ToastType, type Position, type Props, toast };