({ schema, pageName, objects }: Props)
| 28 | } |
| 29 | |
| 30 | export const GraphqlPage = ({ schema, pageName, objects }: Props) => { |
| 31 | const graphqlItems: JSX.Element[] = [] // In the case of the H2s for Queries |
| 32 | |
| 33 | // The queries page has two heading sections (connections and fields) |
| 34 | // So we need to add the heading component and the children under it |
| 35 | // for each section. |
| 36 | if (pageName === 'queries') { |
| 37 | graphqlItems.push( |
| 38 | ...(schema as QueryT[]).map((item) => <Query item={item} key={item.id + item.name} />) |
| 39 | ) |
| 40 | } else if (pageName === 'enums') { |
| 41 | graphqlItems.push( |
| 42 | ...(schema as EnumT[]).map((item) => { |
| 43 | return <Enum key={item.id} item={item} /> |
| 44 | }) |
| 45 | ) |
| 46 | } else if (pageName === 'inputObjects') { |
| 47 | graphqlItems.push( |
| 48 | ...(schema as InputObjectT[]).map((item) => { |
| 49 | return <InputObject key={item.id} item={item} /> |
| 50 | }) |
| 51 | ) |
| 52 | } else if (pageName === 'interfaces' && objects) { |
| 53 | graphqlItems.push( |
| 54 | ...(schema as InterfaceT[]).map((item) => { |
| 55 | return <Interface key={item.id} item={item} objects={objects} /> |
| 56 | }) |
| 57 | ) |
| 58 | } else if (pageName === 'mutations') { |
| 59 | graphqlItems.push( |
| 60 | ...(schema as MutationT[]).map((item) => { |
| 61 | return <Mutation key={item.id} item={item} /> |
| 62 | }) |
| 63 | ) |
| 64 | } else if (pageName === 'objects') { |
| 65 | graphqlItems.push( |
| 66 | ...(schema as ObjectT[]).map((item) => { |
| 67 | return <Object key={item.id} item={item} /> |
| 68 | }) |
| 69 | ) |
| 70 | } else if (pageName === 'scalars') { |
| 71 | graphqlItems.push( |
| 72 | ...(schema as ScalarT[]).map((item) => { |
| 73 | return <Scalar key={item.id} item={item} /> |
| 74 | }) |
| 75 | ) |
| 76 | } else if (pageName === 'unions') { |
| 77 | graphqlItems.push( |
| 78 | ...(schema as UnionT[]).map((item) => { |
| 79 | return <Union key={item.id} item={item} /> |
| 80 | }) |
| 81 | ) |
| 82 | } |
| 83 | |
| 84 | return <div className={cx(styles.automatedPages, styles.markdownBody)}>{graphqlItems}</div> |
| 85 | } |
nothing calls this directly
no outgoing calls
no test coverage detected