1
0
mirror of synced 2025-12-22 03:16:52 -05:00
Files
docs/components/graphql/Union.tsx
2022-08-03 10:51:21 -07:00

31 lines
741 B
TypeScript

import { useRouter } from 'next/router'
import { Link } from 'components/Link'
import { GraphqlItem } from './GraphqlItem'
import { useTranslation } from 'components/hooks/useTranslation'
import type { UnionT } from './types'
type Props = {
item: UnionT
}
export function Union({ item }: Props) {
const { locale } = useRouter()
const { t } = useTranslation('products')
const heading = t('graphql.reference.possible_types')
return (
<GraphqlItem item={item} heading={heading}>
<ul>
{item.possibleTypes.map((type) => (
<li key={type.id}>
<Link href={type.href} locale={locale}>
{type.name}
</Link>
</li>
))}
</ul>
</GraphqlItem>
)
}