File size: 490 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
import Image from "next/image";
export default function PostBody({ content }) {
const renderedContent = content.map((item) => {
if (item.__typename === "Text") {
return <div dangerouslySetInnerHTML={{ __html: item.html }}></div>;
} else if (item.__typename === "Image") {
return <Image src={item.url} alt="image" width={1000} height={500} />;
} else {
return null;
}
});
return <div className="max-w-2xl mx-auto article">{renderedContent}</div>;
}
|