@oberoncms/plugin-uploadthing
Version:
An Puck component and OberonCMS plugin for embeding uploadthing images
26 lines (25 loc) • 616 B
JavaScript
import { jsx, Fragment } from "react/jsx-runtime";
import NextImage from "next/image";
import { ImageIcon } from "@radix-ui/react-icons";
const Image = {
fields: {
image: {
type: "custom",
render: () => /* @__PURE__ */ jsx(Fragment, {})
// only render on the client
}
},
defaultProps: {
image: null
},
render: ({ image }) => {
if (!image) {
return /* @__PURE__ */ jsx(ImageIcon, { height: 100, width: 100 });
}
const { url, height, width, alt } = image;
return /* @__PURE__ */ jsx(NextImage, { src: url, height, width, alt });
}
};
export {
Image
};