UNPKG

@cloakwp/blocks-react

Version:

UI component library for rendering Gutenberg core blocks via the CloakWP Block Renderer.

19 lines (18 loc) 788 B
import { jsx as _jsx } from "react/jsx-runtime"; import { buttonDataRouter } from "@cloakwp/block-data-routers"; import { Button } from "@cloakui/react-primitives/Button"; import { Link } from "@cloakui/react-primitives/Link"; import { configurableBlockPreset } from "../configurableBlockPreset"; export const button = configurableBlockPreset("core/button", { variantsRouter: (block) => (block.attrs.url ? "link" : "default"), variants: { default: { dataRouter: buttonDataRouter, component: Button, }, link: { dataRouter: buttonDataRouter, component: ({ href, children, ...rest }) => (_jsx(Button, { asChild: true, ...rest, children: _jsx(Link, { href: href, children: children }) })), }, }, });