@playbooks/ui
Version:
An interface library for Playbooks.
74 lines (73 loc) • 2.75 kB
JavaScript
import { jsx } from "react/jsx-runtime";
import { a as computeProps, N as Nav$1 } from "./index.es-7ZX4yv7W.js";
import { AccentBtn } from "./buttons.es.js";
import { useUI } from "./context.es.js";
import { Font } from "./fonts.es.js";
import { Div, Ul, Li } from "./html.es.js";
import { AccentLink } from "./links.es.js";
const Nav = ({ name = "Nav", tailwind, className, children, ...props }) => {
const context = useUI();
const base = context?.theme?.nav();
const formatted = { ...base, ...props, ...tailwind };
const filtered = computeProps(props);
return /* @__PURE__ */ jsx(Nav$1, { name, tailwind: formatted, className, ...filtered, children });
};
const NavHeader = ({ name = "NavHeader", tailwind, className, children, ...props }) => {
const context = useUI();
const base = context?.theme?.navHeader();
const computed = { ...base, ...props, tailwind, className, name };
return /* @__PURE__ */ jsx(Div, { ...computed, children });
};
const NavTitle = ({
name = "NavTitle",
size = "h6",
tailwind,
className,
children,
...props
}) => {
const context = useUI();
const base = context?.theme?.navTitle();
const computed = { ...base, ...props, tailwind, className, name };
return /* @__PURE__ */ jsx(Font, { size, ...computed, children });
};
const NavBody = ({ name = "NavBody", size, tailwind, className, children, ...props }) => {
const context = useUI();
const base = context?.theme?.navBody({ size });
const computed = { ...base, ...props, tailwind, className, name };
return /* @__PURE__ */ jsx(Div, { ...computed, children });
};
const NavList = ({ tailwind, children, ...props }) => {
const context = useUI();
const base = context?.theme?.navList();
const computed = { ...base, ...props, tailwind };
return /* @__PURE__ */ jsx(Ul, { ...computed, children });
};
const NavItem = ({ tailwind, children, ...props }) => {
const context = useUI();
const base = context?.theme?.navItem();
const computed = { ...base, ...props, tailwind };
return /* @__PURE__ */ jsx(Li, { ...computed, children });
};
const NavBtn = ({ name = "NavBtn", tailwind, className, children, ...props }) => {
const context = useUI();
const base = context?.theme?.navBtn();
const computed = { ...base, ...props, tailwind, className, children, name };
return /* @__PURE__ */ jsx(AccentBtn, { ...computed });
};
const NavLink = ({ name = "NavLink", tailwind, className, children, ...props }) => {
const context = useUI();
const base = context?.theme?.navLink();
const computed = { ...base, ...props, tailwind, className, children, name };
return /* @__PURE__ */ jsx(AccentLink, { ...computed });
};
export {
Nav,
NavBody,
NavBtn,
NavHeader,
NavItem,
NavLink,
NavList,
NavTitle
};