From fd0324135be7dad2b7e890b29ae4fde21acfa2df Mon Sep 17 00:00:00 2001 From: Natxo <1172351+natxocc@users.noreply.github.com> Date: Tue, 31 Mar 2026 12:16:40 +0200 Subject: [PATCH] Add List component for rendering item lists --- src/components/List.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/components/List.js diff --git a/src/components/List.js b/src/components/List.js new file mode 100644 index 0000000..d7edbac --- /dev/null +++ b/src/components/List.js @@ -0,0 +1,18 @@ +import { $html, $if, $for } from "sigpro"; +import { joinClass, val } from "../core/utils.js"; + +/** LIST */ +export const List = (props) => { + const { items, header, render, keyFn, class: className } = props; + + return $html( + "ul", + { + class: joinClass("list bg-base-100 rounded-box shadow-md", className), + }, + [ + $if(header, () => $html("li", { class: "p-4 pb-2 text-xs opacity-60 tracking-wide" }, [val(header)])), + $for(items, (item, index) => $html("li", { class: "list-row" }, [render(item, index)]), keyFn), + ], + ); +};