import Translate from "@docusaurus/Translate" import { AndLabel } from "@theme/JSONSchemaViewer/labels" import type { JSX } from "react" import type { JSONSchema } from "@theme/JSONSchemaViewer/types" type Props = { schema: Exclude } // minItems function MinItems({ value }: { value: number }): JSX.Element { return ( {">= {count}"} ) } // maxItems function MaxItems({ value }: { value: number }): JSX.Element { return ( {"<= {count}"} ) } // minItems / maxItems export default function ArrayNumberOfItems(props: Props): JSX.Element { const { schema } = props let minAndMax = schema.minItems !== undefined && schema.maxItems !== undefined // Translated label const lengthLabel = ( {"Length :"} ) return (
{lengthLabel}   {schema.minItems !== undefined && } {minAndMax && } {schema.maxItems !== undefined && }
) }