UNPKG

715 BTypeScriptView Raw
1/**
2 * Copyright (c) 2021 GraphQL Contributors.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8import React from 'react';
9import { GraphQLArgument } from 'graphql';
10import TypeLink from './TypeLink';
11import DefaultValue from './DefaultValue';
12
13type ArgumentProps = {
14 arg: GraphQLArgument;
15 showDefaultValue?: boolean;
16};
17
18export default function Argument({ arg, showDefaultValue }: ArgumentProps) {
19 return (
20 <span className="arg">
21 <span className="arg-name">{arg.name}</span>
22 {': '}
23 <TypeLink type={arg.type} />
24 {showDefaultValue !== false && <DefaultValue field={arg} />}
25 </span>
26 );
27}