diff options
author | Remco Bloemen <remco@wicked.ventures> | 2018-11-09 01:32:40 +0800 |
---|---|---|
committer | Remco Bloemen <remco@wicked.ventures> | 2018-11-09 01:32:40 +0800 |
commit | d71362af993d3797dbdbfcac245ad57f0086bce3 (patch) | |
tree | 888826fe23c2d06d6c9191fb3a238e14f9fe4aac /packages/react-docs/src/components/interface.tsx | |
parent | a5665a68756c905637c551fc48c9b7011a55c237 (diff) | |
parent | f6abc007ffb249e4bbf85b8a7a77309d43e0a147 (diff) | |
download | dexon-sol-tools-d71362af993d3797dbdbfcac245ad57f0086bce3.tar dexon-sol-tools-d71362af993d3797dbdbfcac245ad57f0086bce3.tar.gz dexon-sol-tools-d71362af993d3797dbdbfcac245ad57f0086bce3.tar.bz2 dexon-sol-tools-d71362af993d3797dbdbfcac245ad57f0086bce3.tar.lz dexon-sol-tools-d71362af993d3797dbdbfcac245ad57f0086bce3.tar.xz dexon-sol-tools-d71362af993d3797dbdbfcac245ad57f0086bce3.tar.zst dexon-sol-tools-d71362af993d3797dbdbfcac245ad57f0086bce3.zip |
Merge remote-tracking branch 'origin/development' into feature/utils/prettybignum
Diffstat (limited to 'packages/react-docs/src/components/interface.tsx')
-rw-r--r-- | packages/react-docs/src/components/interface.tsx | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/packages/react-docs/src/components/interface.tsx b/packages/react-docs/src/components/interface.tsx index a881c7fec..0df44ca1c 100644 --- a/packages/react-docs/src/components/interface.tsx +++ b/packages/react-docs/src/components/interface.tsx @@ -1,27 +1,30 @@ import * as _ from 'lodash'; import * as React from 'react'; +import { CustomType, TypeDefinitionByName } from '@0x/types'; + import { DocsInfo } from '../docs_info'; -import { CustomType, TypeDocTypes } from '../types'; import { Signature } from './signature'; import { Type } from './type'; +const defaultProps = {}; + export interface InterfaceProps { type: CustomType; sectionName: string; docsInfo: DocsInfo; + typeDefinitionByName: TypeDefinitionByName; + isInPopover: boolean; } -export const Interface = (props: InterfaceProps) => { +export const Interface: React.SFC<InterfaceProps> = (props: InterfaceProps): any => { const type = props.type; - const properties = _.map(type.children, property => { + const properties = _.map(type.children, (property, i) => { return ( - <span key={`property-${property.name}-${property.type}-${type.name}`}> + <span key={`property-${property.name}-${property.type}-${type.name}-${i}`}> {property.name}:{' '} - {property.type && property.type.typeDocType !== TypeDocTypes.Reflection ? ( - <Type type={property.type} sectionName={props.sectionName} docsInfo={props.docsInfo} /> - ) : ( + {property.type && !_.isUndefined(property.type.method) ? ( <Signature name={property.type.method.name} returnType={property.type.method.returnType} @@ -31,6 +34,16 @@ export const Interface = (props: InterfaceProps) => { shouldHideMethodName={true} shouldUseArrowSyntax={true} docsInfo={props.docsInfo} + typeDefinitionByName={props.typeDefinitionByName} + isInPopover={props.isInPopover} + /> + ) : ( + <Type + type={property.type} + sectionName={props.sectionName} + docsInfo={props.docsInfo} + typeDefinitionByName={props.typeDefinitionByName} + isInPopover={props.isInPopover} /> )}, </span> @@ -41,7 +54,14 @@ export const Interface = (props: InterfaceProps) => { const is = type.indexSignature; const param = ( <span key={`indexSigParams-${is.keyName}-${is.keyType}-${type.name}`}> - {is.keyName}: <Type type={is.keyType} sectionName={props.sectionName} docsInfo={props.docsInfo} /> + {is.keyName}:{' '} + <Type + type={is.keyType} + sectionName={props.sectionName} + docsInfo={props.docsInfo} + typeDefinitionByName={props.typeDefinitionByName} + isInPopover={props.isInPopover} + /> </span> ); properties.push( @@ -64,3 +84,5 @@ export const Interface = (props: InterfaceProps) => { </span> ); }; + +Interface.defaultProps = defaultProps; |