mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 06:39:48 +00:00
Adding deprecated warning icon/message in graphQL docs (#2749)
Co-authored-by: Opender Singh <opender94@gmail.com>
This commit is contained in:
parent
b78508d54a
commit
a511ea5ed9
@ -1,5 +1,6 @@
|
||||
// @flow
|
||||
import * as React from 'react';
|
||||
import { SvgIcon } from 'insomnia-components';
|
||||
import GraphQLExplorerTypeLink from './graph-ql-explorer-type-link';
|
||||
import autobind from 'autobind-decorator';
|
||||
import MarkdownPreview from '../markdown-preview';
|
||||
@ -7,6 +8,7 @@ import GraphQLExplorerFieldLink from './graph-ql-explorer-field-link';
|
||||
import type { GraphQLField, GraphQLSchema, GraphQLType } from 'graphql';
|
||||
import { GraphQLInterfaceType, GraphQLObjectType, GraphQLUnionType } from 'graphql';
|
||||
import GraphQLDefaultValue from './graph-ql-default-value';
|
||||
import Tooltip from '../../components/tooltip';
|
||||
|
||||
type Props = {
|
||||
onNavigateType: (type: Object) => void,
|
||||
@ -110,11 +112,20 @@ class GraphQLExplorerType extends React.PureComponent<Props> {
|
||||
<GraphQLExplorerTypeLink onNavigate={this._handleNavigateType} type={field.type} />
|
||||
);
|
||||
|
||||
const isDeprecated = field.isDeprecated;
|
||||
const description = field.description;
|
||||
return (
|
||||
<li key={key}>
|
||||
{fieldLink}
|
||||
{argLinks}: {typeLink} <GraphQLDefaultValue field={field} />
|
||||
{isDeprecated && (
|
||||
<Tooltip
|
||||
message={`The field "${field.name}" is deprecated. ${field.deprecationReason}`}
|
||||
position="bottom"
|
||||
delay={1000}>
|
||||
<SvgIcon icon="warning" />
|
||||
</Tooltip>
|
||||
)}
|
||||
{description && (
|
||||
<div className="graphql-explorer__defs__description">
|
||||
<MarkdownPreview markdown={description} />
|
||||
|
Loading…
Reference in New Issue
Block a user