Update new functions
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { $html, $for } from "sigpro";
|
||||
import { Tag, For } from "sigpro";
|
||||
import { val } from "../core/utils.js";
|
||||
|
||||
export const Dropdown = (props, children) => {
|
||||
@@ -7,28 +7,28 @@ export const Dropdown = (props, children) => {
|
||||
const renderContent = () => {
|
||||
if (items) {
|
||||
const source = typeof items === "function" ? items : () => items;
|
||||
return $html("ul", {
|
||||
return Tag("ul", {
|
||||
tabindex: 0,
|
||||
class: "dropdown-content z-[50] menu p-2 shadow bg-base-100 rounded-box w-52 border border-base-300"
|
||||
}, [
|
||||
$for(source, (item) =>
|
||||
$html("li", {}, [
|
||||
$html("a", {
|
||||
For(source, (item) =>
|
||||
Tag("li", {}, [
|
||||
Tag("a", {
|
||||
class: item.class || "",
|
||||
onclick: (e) => {
|
||||
if (item.onclick) item.onclick(e);
|
||||
if (document.activeElement) document.activeElement.blur();
|
||||
}
|
||||
}, [
|
||||
item.icon ? $html("span", {}, item.icon) : null,
|
||||
$html("span", {}, item.label)
|
||||
item.icon ? Tag("span", {}, item.icon) : null,
|
||||
Tag("span", {}, item.label)
|
||||
])
|
||||
])
|
||||
)
|
||||
]);
|
||||
}
|
||||
|
||||
return $html("div", {
|
||||
return Tag("div", {
|
||||
tabindex: 0,
|
||||
class: "dropdown-content z-[50] p-2 shadow bg-base-100 rounded-box min-w-max border border-base-300"
|
||||
}, [
|
||||
@@ -36,11 +36,11 @@ export const Dropdown = (props, children) => {
|
||||
]);
|
||||
};
|
||||
|
||||
return $html("div", {
|
||||
return Tag("div", {
|
||||
...rest,
|
||||
class: () => `dropdown ${val(props.class) || ""}`,
|
||||
}, [
|
||||
$html("div", {
|
||||
Tag("div", {
|
||||
tabindex: 0,
|
||||
role: "button",
|
||||
class: "btn m-1 flex items-center gap-2",
|
||||
|
||||
Reference in New Issue
Block a user