@playbooks/ui
Version:
An interface library for Playbooks.
73 lines (72 loc) • 2.08 kB
JavaScript
import { jsx, jsxs } from "react/jsx-runtime";
import { TextBtn } from "./buttons.es.js";
import { useUI } from "./context.es.js";
import { Li } from "./html.es.js";
import { FarIcon } from "./icons.es.js";
import { TextLink } from "./links.es.js";
import { Nav, NavList } from "./navs.es.js";
const Breadcrumbs = ({
name = "Breadcrumbs",
tailwind,
className,
children,
...props
}) => {
const context = useUI();
const base = context?.theme?.breadcrumbs();
const computed = { ...base, ...props, tailwind, className, name };
return /* @__PURE__ */ jsx(Nav, { ...computed, children: /* @__PURE__ */ jsx(NavList, { tailwind: { display: "flex flex-row", space: "space-x-2" }, children }) });
};
const BreadcrumbItem = ({
name = "BreadcrumbItem",
icon = "chevron-right",
arrow = true,
tailwind,
className,
children,
...props
}) => {
const context = useUI();
const base = context?.theme?.breadcrumbItem();
const computed = { ...base, ...props, tailwind, className, name };
return /* @__PURE__ */ jsxs(Li, { ...computed, children: [
children,
arrow && /* @__PURE__ */ jsx(FarIcon, { icon, tailwind: { color: "text-gray-400", fontSize: "text-xs", ...tailwind?.icon } })
] });
};
const BreadcrumbBtn = ({
name = "BreadcrumbBtn",
size = "xxs",
active,
onClick,
tailwind,
className,
children,
...props
}) => {
const context = useUI();
const base = context?.theme?.breadcrumbBtn({ active });
const computed = { ...base, ...props, tailwind, size, className, name, active, children };
return /* @__PURE__ */ jsx(TextBtn, { onClick, ...computed });
};
const BreadcrumbLink = ({
name = "BreadcrumbLink",
size = "xxs",
active,
href,
tailwind,
className,
children,
...props
}) => {
const context = useUI();
const base = context?.theme?.breadcrumbLink({ active });
const computed = { ...base, ...props, tailwind, size, className, name, active, children };
return /* @__PURE__ */ jsx(TextLink, { href, ...computed });
};
export {
BreadcrumbBtn,
BreadcrumbItem,
BreadcrumbLink,
Breadcrumbs
};