import { useTranslation } from 'components/hooks/useTranslation' import { ChildBodyParametersRows } from './ChildBodyParametersRows' import type { ChildParamsGroup } from './types' type Props = { name: string type: string | string[] description: string isRequired?: boolean defaultValue?: string enumValues?: string[] slug: string childParamsGroups?: ChildParamsGroup[] | null numPreviews?: number isChild?: boolean } export function ParameterRow({ name, type, description, isRequired, defaultValue, enumValues, slug, childParamsGroups = null, numPreviews = 0, isChild = false, }: Props) { const { t } = useTranslation('products') return ( <>
{name}
{Array.isArray(type) ? type.join(' or ') : type}
{isRequired ? (
{t('rest.reference.required')}
) : null}
{t('rest.reference.default')}:
{defaultValue.toString()}
{t('rest.reference.enum_description_title')}:
{enumValues.map((item, index) => {
return index !== enumValues.length - 1 ? (
{item},{' '}
) : (
{item}
)
})}