public render()

in src/components/TypeDocs.tsx [59:96]


  public render () {
    const { node, all } = this.props
    const extraUrls = buildUrls(all)
    let kind
    let sections
    if (node instanceof Type) {
      kind = 'message'
      const oneofSections = node.oneofsArray.map((oneof) => createOneofSection(oneof, extraUrls))
      const fieldSections = node.fieldsArray.map((field) => createFieldSection(field, extraUrls))
      sections = oneofSections.concat(fieldSections)
    } else if (node instanceof Enum) {
      kind = 'enum'
      const enumValueSectionCreator = (id: string) =>
        createEnumValueSection(node.valuesById[id], id, node.comments[node.valuesById[id]], extraUrls)
      sections = Object.keys(node.valuesById).map(enumValueSectionCreator)
    } else if (node instanceof Service) {
      kind = 'service'
      sections = node.methodsArray.map((method) => createMethodSection(method, extraUrls))
    } else if (node instanceof Namespace) {
      kind = 'package'
    } else {
      kind = 'unknown'
    }
    const name = formatFullName(node.fullName)

    return (
      <React.Fragment>
        <H1 className='type-docs-heading bp3-monospace-text'>
          {name}
          <small> ({kind})</small>
        </H1>
        {node.filename && <p>Defined in: <code>{node.filename}</code></p>}
        <TypeOverview node={node}/>
        <Comment source={node.comment} extraUrls={extraUrls}/>
        {sections}
      </React.Fragment>
    )
  }