MCPcopy Create free account
hub / github.com/github/docs / Table

Function Table

components/graphql/Table.tsx:12–100  ·  view source on GitHub ↗
({ fields }: Props)

Source from the content-addressed store, hash-verified

10}
11
12export function Table({ fields }: Props) {
13 const { locale } = useRouter()
14
15 const { t } = useTranslation('products')
16 const tableName = t('graphql.reference.name')
17 const tableDescription = t('graphql.reference.description')
18
19 return (
20 <table className="fields width-full">
21 <thead>
22 <tr>
23 <th>{tableName}</th>
24 <th>{tableDescription}</th>
25 </tr>
26 </thead>
27 <tbody>
28 {fields.map((field) => (
29 <tr key={field.name}>
30 <td>
31 <p>
32 <code>{field.name}</code> (
33 <code>
34 <Link href={field.href} locale={locale}>
35 {field.type}
36 </Link>
37 </code>
38 )
39 </p>
40 </td>
41 <td>
42 {field.description ? (
43 <span
44 dangerouslySetInnerHTML={{
45 __html: field.description,
46 }}
47 />
48 ) : (
49 'N/A'
50 )}
51 {field.defaultValue !== undefined && (
52 <p>
53 The default value is <code>{field.defaultValue.toString()}</code>.
54 </p>
55 )}
56 {field.preview && <Notice item={field} variant="preview" />}
57 {field.isDeprecated && <Notice item={field} variant="deprecation" />}
58
59 {field.arguments && (
60 <div className="border rounded-1 mt-3 mb-3 p-3 color-bg-subtle f5">
61 <h4 className="pt-0 mt-0">{t('graphql.reference.arguments')}</h4>
62 {field.arguments.map((argument, index) => (
63 <ul
64 key={`${index}-${argument.type.name}-${argument.type.href}`}
65 className="list-style-none pl-0"
66 >
67 <li className="border-top mt-2">
68 <p className="mt-2">
69 <code>{argument.name}</code> (

Callers

nothing calls this directly

Calls 1

useTranslationFunction · 0.90

Tested by

no test coverage detected