diff options
author | Fabio Berger <me@fabioberger.com> | 2017-11-29 01:16:35 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2017-11-29 01:16:35 +0800 |
commit | 3472bdcfd4ea0a6145dd68972f563e483baf7e6b (patch) | |
tree | 6ed8d25cd58cd243aaf94af37f4e9d1d6a98fc85 /packages/website/ts/pages/documentation/type.tsx | |
parent | 78f0ab36823127b67c1ea24b7245c51ba814b16a (diff) | |
download | dexon-sol-tools-3472bdcfd4ea0a6145dd68972f563e483baf7e6b.tar dexon-sol-tools-3472bdcfd4ea0a6145dd68972f563e483baf7e6b.tar.gz dexon-sol-tools-3472bdcfd4ea0a6145dd68972f563e483baf7e6b.tar.bz2 dexon-sol-tools-3472bdcfd4ea0a6145dd68972f563e483baf7e6b.tar.lz dexon-sol-tools-3472bdcfd4ea0a6145dd68972f563e483baf7e6b.tar.xz dexon-sol-tools-3472bdcfd4ea0a6145dd68972f563e483baf7e6b.tar.zst dexon-sol-tools-3472bdcfd4ea0a6145dd68972f563e483baf7e6b.zip |
Refactor docs to be more declarative, put all hard-coded doc-related data in one place so it easier to add new doc pages
Diffstat (limited to 'packages/website/ts/pages/documentation/type.tsx')
-rw-r--r-- | packages/website/ts/pages/documentation/type.tsx | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/packages/website/ts/pages/documentation/type.tsx b/packages/website/ts/pages/documentation/type.tsx index b7d56f360..acd46ab72 100644 --- a/packages/website/ts/pages/documentation/type.tsx +++ b/packages/website/ts/pages/documentation/type.tsx @@ -3,6 +3,7 @@ import {colors} from 'material-ui/styles'; import * as React from 'react'; import {Link as ScrollLink} from 'react-scroll'; import * as ReactTooltip from 'react-tooltip'; +import {DocsInfo} from 'ts/pages/documentation/docs_info'; import {TypeDefinition} from 'ts/pages/documentation/type_definition'; import {Type as TypeDef, TypeDefinitionByName, TypeDocTypes} from 'ts/types'; import {constants} from 'ts/utils/constants'; @@ -38,6 +39,7 @@ const typeToSection: {[typeName: string]: string} = { interface TypeProps { type: TypeDef; + docsInfo: DocsInfo; typeDefinitionByName?: TypeDefinitionByName; } @@ -70,6 +72,7 @@ export function Type(props: TypeProps): any { key={key} type={arg.elementType} typeDefinitionByName={props.typeDefinitionByName} + docsInfo={props.docsInfo} />[] </span> ); @@ -79,6 +82,7 @@ export function Type(props: TypeProps): any { key={`type-${arg.name}-${arg.value}-${arg.typeDocType}`} type={arg} typeDefinitionByName={props.typeDefinitionByName} + docsInfo={props.docsInfo} /> ); return subType; @@ -102,6 +106,7 @@ export function Type(props: TypeProps): any { key={`type-${t.name}-${t.value}-${t.typeDocType}`} type={t} typeDefinitionByName={props.typeDefinitionByName} + docsInfo={props.docsInfo} /> ); }); @@ -141,7 +146,7 @@ export function Type(props: TypeProps): any { </a> ); } else if ((isReference || isArray) && - (typeDocUtils.isPublicType(typeName as string) || + (props.docsInfo.isPublicType(typeName as string) || !_.isUndefined(sectionNameIfExists))) { const id = Math.random().toString(); const typeDefinitionAnchorId = _.isUndefined(sectionNameIfExists) ? typeName : sectionNameIfExists; @@ -176,7 +181,11 @@ export function Type(props: TypeProps): any { id={id} className="typeTooltip" > - <TypeDefinition customType={typeDefinition} shouldAddId={false} /> + <TypeDefinition + customType={typeDefinition} + shouldAddId={false} + docsInfo={props.docsInfo} + /> </ReactTooltip> </span> } |