|
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");
|
|
|
|
const element = document.querySelector(query) as HTMLElement;
|
|
|
|
element.click();
|
|
}
|
|
|
|
export { type ToastType, type Position, type Props, toast };
|
|
|