silverwolf-x's picture
download
raw
2.23 kB
import {
BlockQuote,
BulletList,
CodeBlock,
DotImage,
Heading,
ListItem,
OrderedList,
Paragraph,
TextNode,
} from "./blocks";
/*
dotCMS Block Editor is a new rich content editor that allows you to create your content as building blocks.
More info: https://dotcms.com/docs/latest/block-editor
*/
export const ContentBlocks = ({ content }) => {
return (
<>
{content?.map((data, index) => {
switch (data.type) {
case "paragraph":
return (
<Paragraph key={index}>
<ContentBlocks content={data.content} />
</Paragraph>
);
case "heading":
return (
<Heading key={index} level={data.attrs.level}>
<ContentBlocks content={data.content} />
</Heading>
);
case "bulletList":
return (
<BulletList key={index}>
<ContentBlocks content={data.content} />
</BulletList>
);
case "orderedList":
return (
<OrderedList key={index}>
<ContentBlocks content={data.content} />
</OrderedList>
);
case "dotImage":
return <DotImage key={index} {...data} />;
case "horizontalRule":
return <hr key={index} />;
case "blockquote":
return (
<BlockQuote key={index}>
<ContentBlocks content={data.content} />
</BlockQuote>
);
case "codeBlock":
return (
<CodeBlock language={data.attrs.language} key={index}>
<ContentBlocks content={data.content} />
</CodeBlock>
);
case "hardBreak":
return <br key={index} />;
case "text":
return <TextNode key={index} {...data} />;
case "listItem":
return (
<ListItem key={index}>
<ContentBlocks content={data.content} />
</ListItem>
);
default:
return <p>Block not supported</p>;
}
})}
</>
);
};

Xet Storage Details

Size:
2.23 kB
·
Xet hash:
517106d255783109c5af72564994a61da5a6df6f4cb4421ca953f3508ee1e052

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.