diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2018-08-24 01:58:33 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2018-08-24 01:58:33 +0800 |
commit | 57c104119c409c053eb977553c92341c3ca83afd (patch) | |
tree | 7f1129fd01001604e7412e33ccef202c1ff90612 /packages/react-docs-example/ts/docs.tsx | |
parent | cd5c73550b969fe0a87524143ce617749935427a (diff) | |
parent | 6e27324a341801e1a2d8d6989d749dfe021ae39b (diff) | |
download | dexon-sol-tools-57c104119c409c053eb977553c92341c3ca83afd.tar dexon-sol-tools-57c104119c409c053eb977553c92341c3ca83afd.tar.gz dexon-sol-tools-57c104119c409c053eb977553c92341c3ca83afd.tar.bz2 dexon-sol-tools-57c104119c409c053eb977553c92341c3ca83afd.tar.lz dexon-sol-tools-57c104119c409c053eb977553c92341c3ca83afd.tar.xz dexon-sol-tools-57c104119c409c053eb977553c92341c3ca83afd.tar.zst dexon-sol-tools-57c104119c409c053eb977553c92341c3ca83afd.zip |
Merge branch 'development' into feature/forwarder-helper/init
* development: (187 commits)
Remove trailing slash
Fix linter
Stop nesting interfaces and add necessary type exports
Remove duplicate type and remove nested interface
Add support for rending the Tuple type
Add missing keyu
Remove excessive timestamp
Improve doc commebnt
Remove docs catch-all endpoint
Fix comments
Look for all TS mapped types
Add catch and exit with non-zero
Remove superfluous dep
Fix CHANGELOG entry
Fix double assignment
Upgrade Typedoc to 0.12.0, which works with TS 3.x
Fix prettier issues
Enable dry run of release publishing and handle git tags existing
update yarn.lock
Missing/superfluous type exports from connect
...
Diffstat (limited to 'packages/react-docs-example/ts/docs.tsx')
-rw-r--r-- | packages/react-docs-example/ts/docs.tsx | 123 |
1 files changed, 0 insertions, 123 deletions
diff --git a/packages/react-docs-example/ts/docs.tsx b/packages/react-docs-example/ts/docs.tsx deleted file mode 100644 index bb605806f..000000000 --- a/packages/react-docs-example/ts/docs.tsx +++ /dev/null @@ -1,123 +0,0 @@ -import * as React from 'react'; - -import { - constants, - DocAgnosticFormat, - DocsInfo, - DocsInfoConfig, - Documentation, - SupportedDocJson, - TypeDocNode, -} from '@0xproject/react-docs'; - -import * as v0TypeDocJson from './json/0.1.12.json'; -import * as v2TypeDocJson from './json/0.2.0.json'; - -// tslint:disable-next-line:no-implicit-dependencies no-var-requires -const IntroMarkdownV1 = require('md/introduction'); - -const docSections = { - introduction: 'introduction', - web3Wrapper: 'web3Wrapper', - types: constants.TYPES_SECTION_NAME, -}; - -const docsInfoConfig: DocsInfoConfig = { - id: 'web3Wrapper', - type: SupportedDocJson.TypeDoc, - displayName: 'Web3 Wrapper', - packageUrl: 'https://github.com/0xProject/0x-monorepo', - menu: { - introduction: [docSections.introduction], - web3Wrapper: [docSections.web3Wrapper], - types: [docSections.types], - }, - sectionNameToMarkdownByVersion: { - '0.0.1': { - [docSections.introduction]: IntroMarkdownV1, - }, - }, - sectionNameToModulePath: { - [docSections.web3Wrapper]: ['"web3-wrapper/src/index"'], - [docSections.types]: ['"types/src/index"'], - }, - menuSubsectionToVersionWhenIntroduced: {}, - sections: docSections, - visibleConstructors: [docSections.web3Wrapper], - typeConfigs: { - // Note: This needs to be kept in sync with the types exported in index.ts. Unfortunately there is - // currently no way to extract the re-exported types from index.ts via TypeDoc :( - publicTypes: [ - 'TxData', - 'TransactionReceipt', - 'RawLogEntry', - 'BlockParam', - 'ContractAbi', - 'FilterObject', - 'LogEntry', - 'BlockWithoutTransactionData', - 'CallData', - 'LogEntryEvent', - ], - typeNameToExternalLink: { - Web3: 'https://github.com/ethereum/wiki/wiki/JavaScript-API', - Provider: 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L150', - BigNumber: 'http://mikemcl.github.io/bignumber.js', - }, - typeNameToPrefix: { - Provider: 'Web3', - }, - typeNameToDocSection: { - Web3Wrapper: docSections.web3Wrapper, - }, - }, -}; -const docsInfo = new DocsInfo(docsInfoConfig); - -const availableVersions = ['0.1.12', '0.2.0']; -const versionToDocJSON: { [semver: string]: object } = { - [availableVersions[0]]: v0TypeDocJson, - [availableVersions[1]]: v2TypeDocJson, -}; - -export interface DocsProps {} - -export interface DocsState { - selectedVersion: string; - docAgnosticFormat?: DocAgnosticFormat; -} - -export class Docs extends React.Component<DocsProps, DocsState> { - constructor(props: DocsProps) { - super(props); - this.state = { - selectedVersion: availableVersions[1], - docAgnosticFormat: docsInfo.convertToDocAgnosticFormat(v2TypeDocJson), - }; - } - public render(): React.ReactNode { - return ( - <Documentation - selectedVersion={this.state.selectedVersion} - availableVersions={availableVersions} - docsInfo={docsInfo} - docAgnosticFormat={this.state.docAgnosticFormat} - sourceUrl={this._getSourceUrl()} - onVersionSelected={this._onVersionSelected.bind(this)} - /> - ); - } - private _onVersionSelected(semver: string): void { - const selectedDocJSON = versionToDocJSON[semver]; - this.setState({ - selectedVersion: semver, - docAgnosticFormat: docsInfo.convertToDocAgnosticFormat(selectedDocJSON as TypeDocNode), - }); - } - private _getSourceUrl(): string { - const sourceUrl = `${docsInfoConfig.packageUrl}/blob/@0xproject/web3-wrapper@${ - this.state.selectedVersion - }/packages`; - return sourceUrl; - } -} |