import React, { Fragment } from "react";
import escapeHTML from "escape-html";
import { Text } from "slate";
import { Label } from "../Label";
import { LargeBody } from "../LargeBody";
// eslint-disable-next-line no-use-before-define
type Children = Leaf[];
type Leaf = {
type: string;
value?: {
url: string;
alt: string;
};
children: Children;
url?: string;
[key: string]: unknown;
};
const serialize = (children: Children): React.ReactNode[] =>
children.map((node, i) => {
if (Text.isText(node)) {
let text = (
);
if (node.bold) {
text = {text};
}
if (node.code) {
text = {text};
}
if (node.italic) {
text = {text};
}
if (node.underline) {
text = (
{text}
);
}
if (node.strikethrough) {
text = (
{text}
);
}
return
{serialize(node.children)}; case "ul": return
{serialize(node.children)}
; } }); export default serialize;