This commit is contained in:
2026-04-06 18:07:39 +02:00
parent 294547fc56
commit 071a215393
80 changed files with 593 additions and 2085 deletions

View File

@@ -1,5 +1,5 @@
// components/List.js
import { Tag, If, For } from "../sigpro.js";
// import { Tag, If, For } from "../sigpro.js";
import { ui, val } from "../core/utils.js";
/**
@@ -12,16 +12,22 @@ import { ui, val } from "../core/utils.js";
* - flex, items-center, gap-2
*/
export const List = (props) => {
const { class: className, items, header, render, keyFn = (item, index) => item.id ?? index, ...rest } = props;
const { class: className, items, header, render = (item) => item, keyFn = (item, index) => item.id ?? index, ...rest } = props;
const listItems = For(
items,
(item, index) => Tag("li", { class: "list-row" }, [render(item, index)]),
(item, index) => Tag("li", {
class: "list-row",
style: "width: 100%; display: block;"
}, [
Tag("div", { style: "width: 100%;" }, [render(item, index)])
]),
keyFn
);
return Tag("ul", {
...rest,
style: "display: block; width: 100%;",
class: ui('list bg-base-100 rounded-box shadow-md', className),
}, header ? [If(header, () => Tag("li", { class: "p-4 pb-2 text-xs opacity-60" }, [val(header)])), listItems] : listItems);
}, header ? [If(header, () => Tag("li", { class: "p-4 pb-2 text-xs opacity-60", style: "width: 100%;" }, [val(header)])), listItems] : listItems);
};