fix toast colors

This commit is contained in:
chark1es 2025-02-17 13:52:27 -08:00
parent bdd0941f04
commit 79b34b97de

View file

@ -1,7 +1,7 @@
--- ---
import { Icon } from "astro-icon/components"; import { Icon } from "astro-icon/components";
import JSZip from "jszip"; import JSZip from "jszip";
import FilePreview from "./Officer_EventManagement/FilePreview"; import FilePreview from "./universal/FilePreview";
--- ---
<div id="eventsSection" class="dashboard-section hidden"> <div id="eventsSection" class="dashboard-section hidden">
@ -276,9 +276,27 @@ import FilePreview from "./Officer_EventManagement/FilePreview";
const toast = document.createElement("div"); const toast = document.createElement("div");
toast.className = "toast translate-x-full"; toast.className = "toast translate-x-full";
toast.setAttribute("data-index", "0"); toast.setAttribute("data-index", "0");
// Update alert styling based on type
const alertClass =
type === "success"
? "alert-success bg-success text-success-content"
: type === "error"
? "alert-error bg-error text-error-content"
: "alert-warning bg-warning text-warning-content";
toast.innerHTML = ` toast.innerHTML = `
<div class="alert alert-${type} shadow-lg min-w-[300px]"> <div class="alert ${alertClass} shadow-lg min-w-[300px]">
<span>${message}</span> <div class="flex items-center gap-2">
${
type === "success"
? '<svg xmlns="http://www.w3.org/2000/svg" class="stroke-current shrink-0 h-6 w-6" fill="none" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>'
: type === "error"
? '<svg xmlns="http://www.w3.org/2000/svg" class="stroke-current shrink-0 h-6 w-6" fill="none" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>'
: '<svg xmlns="http://www.w3.org/2000/svg" class="stroke-current shrink-0 h-6 w-6" fill="none" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/></svg>'
}
<span>${message}</span>
</div>
</div> </div>
`; `;