Update new functions
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// components/Menu.js
|
||||
import { $html, $for } from "../sigpro.js";
|
||||
import { Tag, For } from "../sigpro.js";
|
||||
import { val, ui } from "../core/utils.js";
|
||||
|
||||
/**
|
||||
@@ -15,22 +15,22 @@ export const Menu = (props) => {
|
||||
const { class: className, items, ...rest } = props;
|
||||
|
||||
const renderItems = (items) =>
|
||||
$for(
|
||||
For(
|
||||
() => items || [],
|
||||
(it) =>
|
||||
$html("li", {}, [
|
||||
Tag("li", {}, [
|
||||
it.children
|
||||
? $html("details", { open: it.open }, [
|
||||
$html("summary", {}, [it.icon && $html("span", { class: "mr-2" }, it.icon), it.label]),
|
||||
$html("ul", {}, renderItems(it.children)),
|
||||
? Tag("details", { open: it.open }, [
|
||||
Tag("summary", {}, [it.icon && Tag("span", { class: "mr-2" }, it.icon), it.label]),
|
||||
Tag("ul", {}, renderItems(it.children)),
|
||||
])
|
||||
: $html("a", { class: () => (val(it.active) ? "active" : ""), onclick: it.onclick }, [
|
||||
it.icon && $html("span", { class: "mr-2" }, it.icon),
|
||||
: Tag("a", { class: () => (val(it.active) ? "active" : ""), onclick: it.onclick }, [
|
||||
it.icon && Tag("span", { class: "mr-2" }, it.icon),
|
||||
it.label,
|
||||
]),
|
||||
]),
|
||||
(it, i) => it.label || i,
|
||||
);
|
||||
|
||||
return $html("ul", { ...rest, class: ui('menu bg-base-200 rounded-box', className) }, renderItems(items));
|
||||
return Tag("ul", { ...rest, class: ui('menu bg-base-200 rounded-box', className) }, renderItems(items));
|
||||
};
|
||||
Reference in New Issue
Block a user