import React from 'react'
import cx from 'classnames'
import { Enum } from 'components/graphql/Enum'
import { InputObject } from 'components/graphql/InputObject'
import { Interface } from 'components/graphql/Interface'
import { Scalar } from 'components/graphql/Scalar'
import { Mutation } from 'components/graphql/Mutation'
import { Object } from 'components/graphql/Object'
import { Query } from 'components/graphql/Query'
import { Union } from 'components/graphql/Union'
import type {
EnumT,
InputObjectT,
InterfaceT,
MutationT,
ObjectT,
QueryT,
ScalarT,
UnionT,
} from 'components/graphql/types'
import styles from 'components/ui/MarkdownContent/MarkdownContent.module.scss'
type Props = {
schema: Object
pageName: string
objects?: ObjectT[]
}
export const GraphqlPage = ({ schema, pageName, objects }: Props) => {
const graphqlItems: JSX.Element[] = [] // In the case of the H2s for Queries
// The queries page has two heading sections (connections and fields)
// So we need to add the heading component and the children under it
// for each section.
if (pageName === 'queries') {
graphqlItems.push(
...(schema as QueryT[]).map((item) =>