changed to new functions
All checks were successful
Deploy Docs to Synology / deploy (push) Successful in 3s

This commit is contained in:
2026-04-22 12:06:34 +02:00
parent 5a5f593025
commit 59e6d972a8
125 changed files with 1934 additions and 2015 deletions

View File

@@ -1,17 +1,17 @@
// components/Toast.js
import { Tag, Mount } from "sigpro";
import { h, mount } from "sigpro";
export const Toast = (message, type = "alert-success", duration = 3500) => {
let container = document.getElementById("sigpro-toast-container");
if (!container) {
container = Tag("div", {
container = h("div", {
id: "sigpro-toast-container",
class: "fixed top-0 right-0 z-[9999] p-4 flex flex-col gap-2 pointer-events-none"
});
document.body.appendChild(container);
}
const toastHost = Tag("div", { style: "display: contents" });
const toastHost = h("div", { style: "display: contents" });
container.appendChild(toastHost);
let timeoutId;
@@ -32,16 +32,16 @@ export const Toast = (message, type = "alert-success", duration = 3500) => {
};
const ToastComponent = () => {
const closeIcon = Tag("span", { class: "icon-[lucide--x]" });
const closeBtn = Tag("button", {
const closeIcon = h("span", { class: "icon-[lucide--x]" });
const closeBtn = h("button", {
class: "btn btn-xs btn-circle btn-ghost",
onclick: close
}, closeIcon);
const alertDiv = Tag("div", {
const alertDiv = h("div", {
class: `alert alert-soft ${type} shadow-lg transition-all duration-300 translate-x-10 opacity-0 pointer-events-auto`
}, [
Tag("span", {}, typeof message === "function" ? message() : message),
h("span", {}, typeof message === "function" ? message() : message),
closeBtn
]);
@@ -49,7 +49,7 @@ export const Toast = (message, type = "alert-success", duration = 3500) => {
return alertDiv;
};
const instance = Mount(ToastComponent, toastHost);
const instance = mount(ToastComponent, toastHost);
if (duration > 0) timeoutId = setTimeout(close, duration);
return close;
};