Download next.js/examples/cms-prepr/components/post-body.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 490 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/examples/cms-prepr/components/post-body.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/examples/cms-prepr/components/post-body.js
-
curl -L -o post-body.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/examples/cms-prepr/components/post-body.js
490 Bytes
| 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>; | |
| } | |