Add block editing
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
tobias
2024-06-23 22:23:06 +02:00
parent f9ee909e01
commit 60f7a4e4f2
32 changed files with 1061 additions and 256 deletions

View File

@ -0,0 +1,31 @@
import Author from './Author'
export type AdditionalBlockProps = {
blockIndex: number
locale: string
}
const blockComponents = {
Author: Author,
}
const Blocks = ({ blocks, locale }: any) => {
return (
<>
{blocks
?.filter(
(block: any) =>
block && block.blockType && blockComponents.hasOwnProperty(block.blockType),
)
.map((block: any, ix: number) => {
// @ts-ignore
const BlockComponent = blockComponents[block.blockType] ?? null
return BlockComponent ? (
<BlockComponent key={ix} {...block} blockIndex={ix} locale={locale} />
) : null
})}
</>
)
}
export default Blocks