import { nodesToHtml } from "./utils"

import styles from "./jsontohtml.module.css"

import type { DeprecatedJsonToHtmlProps } from "@/types/components/deprecatedjsontohtml"

export default function DeprecatedJsonToHtml({
  embeds,
  nodes,
  renderOptions = {},
}: DeprecatedJsonToHtmlProps) {
  if (!Array.isArray(nodes) || !nodes.length) {
    return null
  }
  return (
    <section className={styles.container}>
      {nodesToHtml(nodes, embeds, renderOptions).filter(Boolean)}
    </section>
  )
}
