diff options
Diffstat (limited to 'packages/website/ts/pages/documentation/method_signature.tsx')
-rw-r--r-- | packages/website/ts/pages/documentation/method_signature.tsx | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/packages/website/ts/pages/documentation/method_signature.tsx b/packages/website/ts/pages/documentation/method_signature.tsx index df3b61814..14b91ab5d 100644 --- a/packages/website/ts/pages/documentation/method_signature.tsx +++ b/packages/website/ts/pages/documentation/method_signature.tsx @@ -6,6 +6,7 @@ import {Parameter, SolidityMethod, TypeDefinitionByName, TypescriptMethod} from interface MethodSignatureProps { method: TypescriptMethod|SolidityMethod; + sectionName: string; shouldHideMethodName?: boolean; shouldUseArrowSyntax?: boolean; typeDefinitionByName?: TypeDefinitionByName; @@ -18,14 +19,19 @@ const defaultProps = { }; export const MethodSignature: React.SFC<MethodSignatureProps> = (props: MethodSignatureProps) => { - const parameters = renderParameters(props.method, props.docsInfo, props.typeDefinitionByName); + const sectionName = 'types'; + const parameters = renderParameters( + props.method, props.docsInfo, sectionName, props.typeDefinitionByName, + ); const paramString = _.reduce(parameters, (prev: React.ReactNode, curr: React.ReactNode) => { return [prev, ', ', curr]; }); const methodName = props.shouldHideMethodName ? '' : props.method.name; const typeParameterIfExists = _.isUndefined((props.method as TypescriptMethod).typeParameter) ? undefined : - renderTypeParameter(props.method, props.docsInfo, props.typeDefinitionByName); + renderTypeParameter( + props.method, props.docsInfo, sectionName, props.typeDefinitionByName, + ); return ( <span> {props.method.callPath}{methodName}{typeParameterIfExists}({paramString}) @@ -34,6 +40,7 @@ export const MethodSignature: React.SFC<MethodSignatureProps> = (props: MethodSi {props.method.returnType && <Type type={props.method.returnType} + sectionName={sectionName} typeDefinitionByName={props.typeDefinitionByName} docsInfo={props.docsInfo} /> @@ -45,7 +52,8 @@ export const MethodSignature: React.SFC<MethodSignatureProps> = (props: MethodSi MethodSignature.defaultProps = defaultProps; function renderParameters( - method: TypescriptMethod|SolidityMethod, docsInfo: DocsInfo, typeDefinitionByName?: TypeDefinitionByName, + method: TypescriptMethod|SolidityMethod, docsInfo: DocsInfo, + sectionName: string, typeDefinitionByName?: TypeDefinitionByName, ) { const parameters = method.parameters; const params = _.map(parameters, (p: Parameter) => { @@ -53,6 +61,7 @@ function renderParameters( const type = ( <Type type={p.type} + sectionName={sectionName} typeDefinitionByName={typeDefinitionByName} docsInfo={docsInfo} /> @@ -67,7 +76,8 @@ function renderParameters( } function renderTypeParameter( - method: TypescriptMethod, docsInfo: DocsInfo, typeDefinitionByName?: TypeDefinitionByName, + method: TypescriptMethod, docsInfo: DocsInfo, + sectionName: string, typeDefinitionByName?: TypeDefinitionByName, ) { const typeParameter = method.typeParameter; const typeParam = ( @@ -75,6 +85,7 @@ function renderTypeParameter( {`<${typeParameter.name} extends `} <Type type={typeParameter.type} + sectionName={sectionName} typeDefinitionByName={typeDefinitionByName} docsInfo={docsInfo} /> |