@prismicio/next
Version:
Helpers to integrate Prismic into Next.js apps
24 lines (23 loc) • 1.2 kB
JavaScript
;
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxRuntime = require("react/jsx-runtime");
const react = require("react");
const Link = require("next/link");
const client = require("@prismicio/client");
const resolveDefaultExport = require("./lib/resolveDefaultExport.cjs");
const PrismicNextLink = react.forwardRef(function PrismicNextLink2(props, ref) {
const { field, document, linkResolver, children, ...restProps } = props;
const { href: computedHref, rel: computedRel, ...attrs } = client.asLinkAttrs(field ?? document, {
linkResolver,
rel: typeof restProps.rel === "function" ? restProps.rel : void 0
});
const href = ("href" in restProps ? restProps.href : computedHref) || "";
let rel = computedRel;
if ("rel" in restProps && typeof restProps.rel !== "function") {
rel = restProps.rel;
}
const ResolvedLink = resolveDefaultExport.resolveDefaultExport(Link);
return jsxRuntime.jsx(ResolvedLink, { ref, ...attrs, ...restProps, href, rel, children: "children" in props ? children : field == null ? void 0 : field.text });
});
exports.PrismicNextLink = PrismicNextLink;
//# sourceMappingURL=PrismicNextLink.cjs.map