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 } // minLength function MinLength({ value }: { value: number }): JSX.Element { return ( {">= {count} character(s)"} ) } // maxLength function MaxLength({ value }: { value: number }): JSX.Element { return ( {"<= {count} character(s)"} ) } // for minLength / maxLength export default function StringLengthQualifierMessage( props: Props, ): JSX.Element { const { schema } = props let minAndMaxLength = schema.minLength !== undefined && schema.maxLength !== undefined // Translated label const lengthLabel = ( {"Length :"} ) return (
{lengthLabel}   {schema.minLength !== undefined && } {minAndMaxLength && } {schema.maxLength !== undefined && }
) }