diff options
author | Fabio Berger <me@fabioberger.com> | 2018-03-07 22:19:59 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-03-07 22:19:59 +0800 |
commit | 9aec1feae30870b3e6c8a778051877c83aacbe58 (patch) | |
tree | e49064325db9c51cc82acc5e177866ad806f7862 /packages/react-docs/src/ts/components | |
parent | 8517de128b591c67f059d6c47722dfa81eeb9828 (diff) | |
download | dexon-sol-tools-9aec1feae30870b3e6c8a778051877c83aacbe58.tar dexon-sol-tools-9aec1feae30870b3e6c8a778051877c83aacbe58.tar.gz dexon-sol-tools-9aec1feae30870b3e6c8a778051877c83aacbe58.tar.bz2 dexon-sol-tools-9aec1feae30870b3e6c8a778051877c83aacbe58.tar.lz dexon-sol-tools-9aec1feae30870b3e6c8a778051877c83aacbe58.tar.xz dexon-sol-tools-9aec1feae30870b3e6c8a778051877c83aacbe58.tar.zst dexon-sol-tools-9aec1feae30870b3e6c8a778051877c83aacbe58.zip |
Move remaining type configs to topLevel DocsInfoConfigs
Diffstat (limited to 'packages/react-docs/src/ts/components')
-rw-r--r-- | packages/react-docs/src/ts/components/type.tsx | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/packages/react-docs/src/ts/components/type.tsx b/packages/react-docs/src/ts/components/type.tsx index f3efbc8dd..56425a5df 100644 --- a/packages/react-docs/src/ts/components/type.tsx +++ b/packages/react-docs/src/ts/components/type.tsx @@ -11,21 +11,6 @@ import { utils } from '../utils/utils'; import { TypeDefinition } from './type_definition'; -// Some types reference other libraries. For these types, we want to link the user to the relevant documentation. -const typeToUrl: { [typeName: string]: string } = { - Web3: constants.URL_WEB3_DOCS, - Provider: constants.URL_WEB3_PROVIDER_DOCS, - BigNumber: constants.URL_BIGNUMBERJS_GITHUB, - DecodedLogEntryEvent: constants.URL_WEB3_DECODED_LOG_ENTRY_EVENT, - LogEntryEvent: constants.URL_WEB3_LOG_ENTRY_EVENT, -}; - -const typePrefix: { [typeName: string]: string } = { - Provider: 'Web3', - DecodedLogEntryEvent: 'Web3', - LogEntryEvent: 'Web3', -}; - const typeToSection: { [typeName: string]: string } = { ExchangeWrapper: 'exchange', TokenWrapper: 'token', @@ -149,9 +134,20 @@ export function Type(props: TypeProps): any { return [prev, ', ', curr]; }); - const typeNameUrlIfExists = typeToUrl[typeName as string]; - const typePrefixIfExists = typePrefix[typeName as string]; - const sectionNameIfExists = typeToSection[typeName as string]; + let typeNameUrlIfExists; + let typePrefixIfExists; + let sectionNameIfExists; + if (!_.isUndefined(props.docsInfo.typeConfigs)) { + typeNameUrlIfExists = !_.isUndefined(props.docsInfo.typeConfigs.typeNameToExternalLink) + ? props.docsInfo.typeConfigs.typeNameToExternalLink[typeName as string] + : undefined; + typePrefixIfExists = !_.isUndefined(props.docsInfo.typeConfigs.typeNameToPrefix) + ? props.docsInfo.typeConfigs.typeNameToPrefix[typeName as string] + : undefined; + sectionNameIfExists = !_.isUndefined(props.docsInfo.typeConfigs.typeNameToDocSection) + ? props.docsInfo.typeConfigs.typeNameToDocSection[typeName as string] + : undefined; + } if (!_.isUndefined(typeNameUrlIfExists)) { typeName = ( <a |