mirror of
https://github.com/LD-Reborn/Berufsschule_HAM.git
synced 2025-12-20 06:51:55 +00:00
Fixed toast warning type not accessible
This commit is contained in:
@@ -12,14 +12,19 @@ function showToast(message, type) {
|
|||||||
const toast = document.createElement('div');
|
const toast = document.createElement('div');
|
||||||
toast.className = `toast align-items-center text-white bg-${type} border-0`;
|
toast.className = `toast align-items-center text-white bg-${type} border-0`;
|
||||||
toast.role = 'alert';
|
toast.role = 'alert';
|
||||||
|
var useDarkElements = type === "warning"
|
||||||
toast.innerHTML = `
|
toast.innerHTML = `
|
||||||
<div class="d-flex">
|
<div class="d-flex">
|
||||||
<div class="toast-body">${message}</div>
|
<div class="toast-body">${message}</div>
|
||||||
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast"></button>
|
<button type="button" class="btn-close${useDarkElements ? "" : "-white"} me-2 m-auto"${useDarkElements ? ' style="filter: unset;"' : ""} data-bs-dismiss="toast" aria-label="${window.appTranslations.closeAlert}"></button>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
if (useDarkElements) {
|
||||||
|
toast.classList.remove("text-white");
|
||||||
|
toast.classList.add("text-dark");
|
||||||
|
}
|
||||||
toastContainer.appendChild(toast);
|
toastContainer.appendChild(toast);
|
||||||
const bsToast = new bootstrap.Toast(toast, { delay: 3000 });
|
const bsToast = new bootstrap.Toast(toast, { delay: 5000 });
|
||||||
bsToast.show();
|
bsToast.show();
|
||||||
toast.addEventListener('hidden.bs.toast', () => toast.remove());
|
toast.addEventListener('hidden.bs.toast', () => toast.remove());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user