UNPKG

@prismicio/next

Version:

Helpers to integrate Prismic into Next.js apps

31 lines (30 loc) 1.26 kB
import { jsx } from "react/jsx-runtime"; import { disableEventHandler, getDefaultProps, onClickHandler, simulatorClass, simulatorRootClass } from "@prismicio/simulator/kit"; //#region src/SliceSimulatorWrapper.tsx /** A wrapper for the slice simulator that isolates the given children from the page's layout. */ const SliceSimulatorWrapper = ({ className, children, zIndex, background, message, hasSlices }) => { const defaultProps = getDefaultProps(); return /* @__PURE__ */ jsx("div", { className: [simulatorClass, className].filter(Boolean).join(" "), style: { zIndex: typeof zIndex === "undefined" ? defaultProps.zIndex : zIndex ?? void 0, position: "fixed", top: 0, left: 0, width: "100%", height: "100vh", overflow: "auto", background: typeof background === "undefined" ? defaultProps.background : background ?? void 0 }, children: message ? /* @__PURE__ */ jsx("article", { dangerouslySetInnerHTML: { __html: message } }) : hasSlices ? /* @__PURE__ */ jsx("div", { id: "root", className: simulatorRootClass, onClickCapture: onClickHandler, onSubmitCapture: disableEventHandler, children }) : null }); }; //#endregion export { SliceSimulatorWrapper }; //# sourceMappingURL=SliceSimulatorWrapper.js.map