1
0
mirror of synced 2025-12-23 11:54:18 -05:00
Files
docs/components/parameter-table/ChildBodyParametersRows.tsx
Robert Sese b2e5d14036 Automate + Reactify webhooks page (#29534)
Co-authored-by: Rachael Sewell <rachmari@github.com>
Co-authored-by: Peter Bengtsson <mail@peterbe.com>
Co-authored-by: Joe Oak <41307427+joeoak@users.noreply.github.com>
Co-authored-by: Sarah Edwards <skedwards88@github.com>
Co-authored-by: Grace Park <gracepark@github.com>
Co-authored-by: Peter Bengtsson <peterbe@github.com>
2022-11-15 22:12:16 +00:00

60 lines
1.7 KiB
TypeScript

import cx from 'classnames'
import { useTranslation } from 'components/hooks/useTranslation'
import { ParameterRow } from './ParameterRow'
import type { ChildParameter } from './types'
import styles from './ChildBodyParametersRows.module.scss'
type Props = {
open: boolean
slug: string
childParamsGroups: ChildParameter[]
parentName: string
parentType: string
}
export function ChildBodyParametersRows({
open,
slug,
parentName,
parentType,
childParamsGroups,
}: Props) {
const { t } = useTranslation(['parameter_table', 'products'])
return (
<tr className={cx(styles.childBodyParametersRows, 'color-bg-subtle border-top-0')}>
<td colSpan={4} className="has-nested-table">
<details className="box px-3 ml-1 mb-0" open={open}>
<summary role="button" aria-expanded="false" className="mb-2 keyboard-focus">
<span id={`${slug}-${parentName}-${parentType}`}>
Properties of <code>{parentName}</code>
</span>
</summary>
<table id={`${parentName}-object`} className="mb-4 color-bg-subtle">
<thead className="visually-hidden">
<tr>
<th>{`${t('name')}, ${t('type')}, ${t('description')}`}</th>
</tr>
</thead>
<tbody>
{childParamsGroups.map((childParam, index) => {
return (
<ParameterRow
rowParams={childParam}
slug={slug}
isChild={true}
key={childParam.name}
rowIndex={index}
/>
)
})}
</tbody>
</table>
</details>
</td>
</tr>
)
}