diff options
author | Fabio Berger <me@fabioberger.com> | 2018-08-17 05:57:45 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-08-17 05:57:45 +0800 |
commit | 8e3df2b5aeac9d6776640be1248863055c75cf4a (patch) | |
tree | 97fd70a5f9b821334f0590b63557b6bac39924a5 /packages/react-docs/src/components | |
parent | bf9ee82d9f4a2fec392f0ee58342fc6b3be94dff (diff) | |
download | dexon-sol-tools-8e3df2b5aeac9d6776640be1248863055c75cf4a.tar dexon-sol-tools-8e3df2b5aeac9d6776640be1248863055c75cf4a.tar.gz dexon-sol-tools-8e3df2b5aeac9d6776640be1248863055c75cf4a.tar.bz2 dexon-sol-tools-8e3df2b5aeac9d6776640be1248863055c75cf4a.tar.lz dexon-sol-tools-8e3df2b5aeac9d6776640be1248863055c75cf4a.tar.xz dexon-sol-tools-8e3df2b5aeac9d6776640be1248863055c75cf4a.tar.zst dexon-sol-tools-8e3df2b5aeac9d6776640be1248863055c75cf4a.zip |
Render external dep exports
Diffstat (limited to 'packages/react-docs/src/components')
-rw-r--r-- | packages/react-docs/src/components/documentation.tsx | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/packages/react-docs/src/components/documentation.tsx b/packages/react-docs/src/components/documentation.tsx index 82e444018..43a1f746e 100644 --- a/packages/react-docs/src/components/documentation.tsx +++ b/packages/react-docs/src/components/documentation.tsx @@ -19,6 +19,7 @@ import { AddressByContractName, DocAgnosticFormat, Event, + ExternalExportToLink, Property, SolidityMethod, SupportedDocJson, @@ -26,6 +27,7 @@ import { TypescriptFunction, TypescriptMethod, } from '../types'; +import { constants } from '../utils/constants'; import { Badge } from './badge'; import { Comment } from './comment'; @@ -300,6 +302,8 @@ export class Documentation extends React.Component<DocumentationProps, Documenta <div>{eventDefs}</div> </div> )} + {!_.isUndefined(docSection.externalExportToLink) && + this._renderExternalExports(docSection.externalExportToLink)} {!_.isUndefined(typeDefs) && typeDefs.length > 0 && ( <div> @@ -309,6 +313,22 @@ export class Documentation extends React.Component<DocumentationProps, Documenta </div> ); } + private _renderExternalExports(externalExportToLink: ExternalExportToLink): React.ReactNode { + const externalExports = _.map(externalExportToLink, (link: string, exportName: string) => { + return ( + <div className="pt2"> + <code className={`hljs ${constants.TYPE_TO_SYNTAX[this.props.docsInfo.type]}`}> + {`import { `} + <a href={link} target="_blank" style={{ color: colors.lightBlueA700, textDecoration: 'none' }}> + {exportName} + </a> + {` } from '${this.props.docsInfo.displayName}'`} + </code> + </div> + ); + }); + return <div>{externalExports}</div>; + } private _renderNetworkBadgesIfExists(sectionName: string): React.ReactNode { if (this.props.docsInfo.type !== SupportedDocJson.Doxity) { return null; |