UNPKG

json-joy

Version:

Collection of libraries for building collaborative editing apps.

46 lines 1.62 kB
import * as React from 'react'; import { CommonSliceType } from '../../../../json-crdt-extensions'; import { Blockquote } from './Blockquote'; import { Codeblock } from './Codeblock'; export const RenderBlock = (props) => { const { block, children } = props; const tag = block.tag(); switch (tag) { case '': return children; case CommonSliceType.codeblock: { return React.createElement(Codeblock, { ...props }); } case CommonSliceType.blockquote: { return React.createElement(Blockquote, { ...props }); } case CommonSliceType.h1: { return React.createElement("h1", null, children); } case CommonSliceType.h2: { return React.createElement("h2", null, children); } case CommonSliceType.h3: { return React.createElement("h3", null, children); } case CommonSliceType.h4: { return React.createElement("h4", null, children); } case CommonSliceType.h5: { return React.createElement("h5", null, children); } case CommonSliceType.h6: { return React.createElement("h6", null, children); } case CommonSliceType.title: { return React.createElement("h1", null, children); } case CommonSliceType.subtitle: { return React.createElement("h2", null, children); } default: { return React.createElement("p", { style: { padding: '16px 0' } }, children); } } }; //# sourceMappingURL=index.js.map