import Image from "next/image";
import { documentToReactComponents } from "@contentful/rich-text-react-renderer";
import { BLOCKS } from "@contentful/rich-text-types";
interface Asset {
sys: {
id: string;
};
url: string;
description: string;
}
interface AssetLink {
block: Asset[];
}
interface Content {
json: any;
links: {
assets: AssetLink;
};
}
function RichTextAsset({
id,
assets,
}: {
id: string;
assets: Asset[] | undefined;
}) {
const asset = assets?.find((asset) => asset.sys.id === id);
if (asset?.url) {
return ;
}
return null;
}
export function Markdown({ content }: { content: Content }) {
return documentToReactComponents(content.json, {
renderNode: {
[BLOCKS.EMBEDDED_ASSET]: (node: any) => (
),
},
});
}