fix: migrate toasts from daisyui to tailwind
All checks were successful
Build Docker Image / Build-Docker-Image (push) Successful in 4m16s
Build and Push Docker Image / Build-And-Push-Docker-Image (push) Successful in 4m51s

This commit was merged in pull request #54.
This commit is contained in:
2025-05-06 15:35:16 +02:00
parent ac0c918da7
commit 81380f184e
4 changed files with 22 additions and 30 deletions

View File

@@ -3,14 +3,13 @@
function getClass(type) {
switch (type) {
case "error":
return "alert-error";
return ["bg-amber-900", "text-white"];
case "warning":
return "alert-warning";
return ["bg-yellow-200", "text-gray-800"];
case "success":
return "alert-success";
// case "info":
return ["bg-green-900", "text-white"];
default:
return "alert-info";
return ["bg-gray-800", "text-white"];
}
}
@@ -21,20 +20,22 @@ htmx.on("toast", (e) => {
const template = document.getElementById("toast");
const toast = template.cloneNode(true);
const parent = document.getElementById("toasts");
const list = document.getElementById("toasts");
toast.id = ""
toast.classList.remove("hidden");
toast.classList.add(getClass(type));
toast.classList.add(...getClass(type));
toast.innerText = message;
parent.appendChild(toast);
list.appendChild(toast);
setTimeout(() => {
toast.classList.remove("opacity-0");
}, 0);
setTimeout(() => {
toast.classList.add("animate-fade");
toast.classList.add("opacity-0");
setTimeout(() => {
parent.removeChild(toast);
list.removeChild(toast);
}, 250);
}, 5000);
});