fix(SW-1831): add fragment * fix(SW-1831): add fragment * fix(SW-1831): move fragment to nodesToHtml * fix(SW-1831): remove import * fix(SW-1831): add getUniqueId Approved-by: Erik Tiekstra Approved-by: Matilda Landström
25 lines
545 B
TypeScript
25 lines
545 B
TypeScript
import { cx } from "class-variance-authority"
|
|
|
|
import { nodesToHtml } from "./utils"
|
|
|
|
import styles from "./jsontohtml.module.css"
|
|
|
|
import type { JsonToHtmlProps } from "@/types/transitionTypes/jsontohtml"
|
|
|
|
export default function JsonToHtml({
|
|
embeds,
|
|
nodes,
|
|
renderOptions = {},
|
|
className,
|
|
}: JsonToHtmlProps) {
|
|
if (!Array.isArray(nodes) || !nodes.length) {
|
|
return null
|
|
}
|
|
|
|
return (
|
|
<section className={cx(styles.container, className)}>
|
|
{nodesToHtml(nodes, embeds, renderOptions).filter(Boolean)}
|
|
</section>
|
|
)
|
|
}
|