forked from github/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
2,374,757 additions
and
380,312 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
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, //waiting on github #218747 to merge before adding enum support | ||
slug, | ||
childParamsGroups = null, | ||
numPreviews = 0, | ||
isChild = false, | ||
}: Props) { | ||
const { t } = useTranslation('products') | ||
|
||
return ( | ||
<> | ||
<tr className={`${isChild ? 'color-bg-subtle' : ''}`}> | ||
<td className={`${isChild ? 'pl-2' : ''}`}> | ||
<div> | ||
<code className={`text-bold ${isChild ? 'f6' : 'f5'}`}>{name}</code> | ||
<span className="color-fg-muted pl-2 f5"> | ||
{Array.isArray(type) ? type.join(' or ') : type} | ||
</span> | ||
{isRequired ? ( | ||
<span className={`color-fg-attention f5 ${isChild ? 'pl-3' : 'float-right'}`}> | ||
{t('rest.reference.required')} | ||
</span> | ||
) : null} | ||
</div> | ||
|
||
<div className="pl-1 pt-2 color-fg-muted f5"> | ||
<div dangerouslySetInnerHTML={{ __html: description }} /> | ||
{numPreviews > 0 && ( | ||
<a href={`#${slug}-preview-notices`} className="d-inline"> | ||
{numPreviews > 1 | ||
? ` ${t('rest.reference.see_preview_notices')}` | ||
: ` ${t('rest.reference.see_preview_notice')}`} | ||
</a> | ||
)} | ||
<div className="pt-2"> | ||
{defaultValue && ( | ||
<p> | ||
<span>{t('rest.reference.default')}: </span> | ||
<code>{defaultValue.toString()}</code> | ||
</p> | ||
)} | ||
{/* waiting on github #218747 to merge before adding enum support */} | ||
{/* {enumValues && ( | ||
<p> | ||
<span>{t('rest.reference.enum_description_title')}: </span> | ||
{enumValues.map((item, index) => { | ||
return index !== enumValues.length - 1 ? ( | ||
<span key={item + index}> | ||
<code>{item}</code>,{' '} | ||
</span> | ||
) : ( | ||
<span key={item + index}> | ||
<code>{item}</code> | ||
</span> | ||
) | ||
})} | ||
</p> | ||
)} */} | ||
</div> | ||
</div> | ||
</td> | ||
</tr> | ||
{childParamsGroups && childParamsGroups.length > 0 && ( | ||
<ChildBodyParametersRows slug={slug} childParamsGroups={childParamsGroups} /> | ||
)} | ||
</> | ||
) | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.