Update new functions
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// components/List.js
|
||||
import { $html, $if, $for } from "../sigpro.js";
|
||||
import { Tag, If, For } from "../sigpro.js";
|
||||
import { ui, val } from "../core/utils.js";
|
||||
|
||||
/**
|
||||
@@ -14,14 +14,14 @@ import { ui, val } from "../core/utils.js";
|
||||
export const List = (props) => {
|
||||
const { class: className, items, header, render, keyFn = (item, index) => item.id ?? index, ...rest } = props;
|
||||
|
||||
const listItems = $for(
|
||||
const listItems = For(
|
||||
items,
|
||||
(item, index) => $html("li", { class: "list-row" }, [render(item, index)]),
|
||||
(item, index) => Tag("li", { class: "list-row" }, [render(item, index)]),
|
||||
keyFn
|
||||
);
|
||||
|
||||
return $html("ul", {
|
||||
return Tag("ul", {
|
||||
...rest,
|
||||
class: ui('list bg-base-100 rounded-box shadow-md', className),
|
||||
}, header ? [$if(header, () => $html("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" }, [val(header)])), listItems] : listItems);
|
||||
};
|
||||
Reference in New Issue
Block a user