import React from 'react'
import type { JSX } from 'react'
import cx from 'classnames'
import { Enum } from './Enum'
import { InputObject } from './InputObject'
import { Interface } from './Interface'
import { Scalar } from './Scalar'
import { Mutation } from './Mutation'
import { Object } from './Object'
import { Query } from './Query'
import { Union } from './Union'
import type {
EnumT,
InputObjectT,
InterfaceT,
MutationT,
ObjectT,
QueryT,
ScalarT,
UnionT,
} from './types'
import styles from '@/frame/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) =>