-
-
Save chenkovsky/b916a3720623d4d1724331fca453390f to your computer and use it in GitHub Desktop.
Revisions
-
davidjbeaver created this gist
Nov 12, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ import { For } from "solid-js"; import store from "./store"; import { ToastObject, ToastType } from "./types"; const Toast = () => { return ( <div class="toast-container"> <For each={store.toastStore.toasts}> {(toast: ToastObject) => ( <div class="toast" className={toast.toastType}> <i class="icon" classList={{ "icon-check-circle": toast.toastType === ToastType.Success, "icon-x-circle": toast.toastType === ToastType.Error, "icon-alert-circle": toast.toastType === ToastType.Warning, "icon-info": toast.toastType === ToastType.Info, }} ></i> <span>{toast.message}</span> <button onClick={() => store.removeToast(toast.toastId)}>X</button> </div> )} </For> </div> ); }; export default Toast