1
0
mirror of synced 2025-12-19 18:10:59 -05:00
Files
docs/src/graphql/components/Mutation.tsx

43 lines
1.3 KiB
TypeScript

import { Link } from '@/frame/components/Link'
import { GraphqlItem } from './GraphqlItem'
import { Notice } from './Notice'
import { useTranslation } from '@/languages/components/useTranslation'
import { Table } from './Table'
import type { MutationT } from './types'
import React from 'react'
type Props = {
item: MutationT
}
export function Mutation({ item }: Props) {
const { t } = useTranslation('graphql')
const heading = t('reference.input_fields').replace('{{ GraphQLItemTitle }}', item.name)
const heading2 = t('reference.return_fields').replace('{{ GraphQLItemTitle }}', item.name)
return (
<GraphqlItem item={item} heading={heading}>
{item.inputFields.map((input) => (
<React.Fragment key={input.id}>
<ul>
<li>
<code>{input.name}</code> (
<code>
<Link href={input.href} makeAbsolute>
{input.type}
</Link>
</code>
)
</li>
</ul>
{input.preview && <Notice item={input} variant="preview" />}
{input.isDeprecated && <Notice item={input} variant="deprecation" />}
<h4 dangerouslySetInnerHTML={{ __html: heading2 }} />
<Table fields={item.returnFields} />
</React.Fragment>
))}
</GraphqlItem>
)
}