@playbooks/ui
Version:
An interface library for Playbooks.
39 lines (38 loc) • 1.37 kB
JavaScript
import { jsx } from "react/jsx-runtime";
import { a as computeProps, N as Nav } from "./index.es-7ZX4yv7W.js";
import { useUI } from "./context.es.js";
import { Img, Ul } from "./html.es.js";
import { LinkWrapper } from "./links.es.js";
const Navbar = ({ name = "Navbar", tailwind, className, children, ...props }) => {
const context = useUI();
const base = context?.theme?.navbar();
const formatted = { ...base, ...props, ...tailwind };
const filtered = computeProps(props);
return /* @__PURE__ */ jsx(Nav, { name, tailwind: formatted, className, ...filtered, children });
};
const NavbarBrand = ({
name = "NavbarBrand",
href = "/",
src,
alt = "home",
tailwind,
className,
children,
...props
}) => {
const context = useUI();
const base = context?.theme?.navbarBrand();
const computed = { ...base, ...props, tailwind, className };
return /* @__PURE__ */ jsx(LinkWrapper, { alt, name, href, ...computed, children: /* @__PURE__ */ jsx(Img, { src, alt: "Brand logo", width: "w-full" }) });
};
const NavbarList = ({ name = "NavbarList", tailwind, className, children, ...props }) => {
const context = useUI();
const base = context?.theme?.navbarList();
const computed = { ...base, ...props, tailwind, className, name };
return /* @__PURE__ */ jsx(Ul, { ...computed, children });
};
export {
Navbar,
NavbarBrand,
NavbarList
};