import cx from 'classnames' import { useTranslation } from 'components/hooks/useTranslation' import { ChildBodyParametersRows } from './ChildBodyParametersRows' import type { ChildParameter } from './types' type Props = { rowParams: ChildParameter slug: string numPreviews?: number isChild?: boolean rowIndex?: number } export function ParameterRow({ rowParams, slug, numPreviews = 0, rowIndex = 0, isChild = false, }: Props) { const { t } = useTranslation(['parameter_table', 'products']) return ( <>
{rowParams.name}
{rowParams.type}
{rowParams.isRequired ? (
{t('required')}
) : null}
{t('default')}:
{rowParams.default}
{rowParams.enum.length > 1 ? (
<>
{t('enum_description_title')}:
{rowParams.enum.map((item, index, array) => (
{item}
{index !== array.length - 1 && ','}{' '}
))}
>
) : (
<>
{t('single_enum_description')}:
{rowParams.enum[0]}
>
)}