import { Type, createBlock } from "camox/createBlock"; import { Link } from "camox/navigation"; import type { ReactElement } from "react"; import { Button } from "@/components/ui/button"; const navbar = createBlock({ id: "navbar", title: "Navbar", layoutOnly: true, description: "A navigation bar at the top of a page with a brand name, navigation links, and a call-to-action link.", content: { title: Type.Link({ title: "Site name", default: { href: "/", text: "{{projectName}}", newTab: false, }, }), links: Type.Repeater({ content: { link: Type.Link({ default: { text: "Link", href: "#", newTab: false }, title: "Link", }), }, minItems: 1, maxItems: 6, title: "Links", toMarkdown: (c) => [c.link], }), cta: Type.Link({ default: { text: "Get started", href: "#", newTab: false }, title: "Call to action", }), }, settings: { sticky: Type.Boolean({ default: true, title: "Sticky", }), }, component: NavbarComponent, toMarkdown: (c) => [c.title, c.links, c.cta], }); function NavbarComponent(): ReactElement { const sticky = navbar.useSetting("sticky"); const innerContent = (
{(props) => }
{(linkItem) => ( {(props) => ( )} )} {(props) => (
); if (!sticky) { return ; } return ( <>
{(props) => ( )} ); } export { navbar as block };