Spaces:
Sleeping
Sleeping
| const wrapper = document.querySelector(".notifications"); | |
| const toast = (message, type) => { | |
| const notification = document.createElement("div"); | |
| notification.innerHTML = ` | |
| <i class="fa fa-xmark close" onclick="this.parentNode.remove()"></i> | |
| <i class="fa-solid ${ | |
| type === "error" ? "fa-circle-xmark" : "fa-triangle-exclamation" | |
| } icon"></i> | |
| <div class="notification-content"> | |
| <h3>${type}</h3> | |
| <p>${message}</p> | |
| </div> | |
| `; | |
| notification.classList.add(...["notification", type]); | |
| wrapper.appendChild(notification); | |
| setTimeout(() => { | |
| notification.remove(); | |
| }, 10000); | |
| }; | |