import React from "react"; import { Content, Data, generateReactElements } from "../Components"; import { Some } from "../utils/Some"; import { getClassName } from "../utils/getClassName"; type Props = { readonly className: string; readonly children: Data[]; readonly content: Content[]; }; export const OrderedList = ({ className, children, content }: Props) => { return (
    {children.map((child, index) => { const liAttributes = child.attributes || {}; const liClassName = Some(liAttributes.class) ? getClassName(liAttributes.class) : getClassName(liAttributes.classname); // Check if child.content has one string element if (child.content?.length === 1 && typeof child.content[0] === "string") { return (
  1. {child.content[0]}
  2. ); } const nestedChildren = child.content || []; return (
  3. {nestedChildren.map((nestedChild, nestedIndex) => ( {typeof nestedChild === "string" ? nestedChild : generateReactElements(nestedChild, content)} ))}
  4. ); })}
); };