Next Preview Work Final
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// components/List.js
|
||||
import { $html, $if, $for } from "sigpro";
|
||||
import { $html, $if, $for } from "../sigpro.js";
|
||||
import { ui, val } from "../core/utils.js";
|
||||
|
||||
/**
|
||||
@@ -12,7 +12,7 @@ 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) => index, ...rest } = props;
|
||||
const { class: className, items, header, render, keyFn = (item, index) => item.id ?? index, ...rest } = props;
|
||||
|
||||
const listItems = $for(
|
||||
items,
|
||||
@@ -20,12 +20,8 @@ export const List = (props) => {
|
||||
keyFn
|
||||
);
|
||||
|
||||
return $html(
|
||||
"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
|
||||
);
|
||||
return $html("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);
|
||||
};
|
||||
Reference in New Issue
Block a user