aboutsummaryrefslogtreecommitdiffstats
path: root/packages/react-docs/example/ts/index.tsx
blob: 8cfa8451c9c330069812e028b6111db5998e1f4e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import 'basscss/css/basscss.css';
import 'less/all.less';
import { MuiThemeProvider } from 'material-ui/styles';
import * as React from 'react';
import { render } from 'react-dom';
import * as injectTapEventPlugin from 'react-tap-event-plugin';

import { Documentation } from '../../src/ts/components/documentation';
import { DocsInfo } from '../../src/ts/docs_info';
import { DocsInfoConfig, SupportedDocJson } from '../../src/ts/types';
injectTapEventPlugin();

/* tslint:disable:no-var-requires */
const IntroMarkdown = require('md/introduction');
/* tslint:enable:no-var-requires */

const docSections = {
    introduction: 'introduction',
    web3Wrapper: 'web3Wrapper',
};

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],
    },
    sectionNameToMarkdown: {
        [docSections.introduction]: IntroMarkdown,
    },
    // 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'],
    sectionNameToModulePath: {
        [docSections.web3Wrapper]: ['"index"'],
    },
    menuSubsectionToVersionWhenIntroduced: {},
    sections: docSections,
    visibleConstructors: [docSections.web3Wrapper],
};
const docsInfo = new DocsInfo(docsInfoConfig);

const selectedVersion = '0.2.0';
const availableVersions = ['0.1.12', '0.1.13', '0.1.14', '0.2.0'];

const sourceUrl = `${
    docsInfoConfig.packageUrl
}/blob/@0xproject/web3-wrapper%40${selectedVersion}/packages/web3-wrapper`;

import * as typeDocJson from './json/web3_wrapper_typedoc_output.json';
const docAgnosticFormat = docsInfo.convertToDocAgnosticFormat(typeDocJson);

render(
    <MuiThemeProvider>
        <Documentation
            selectedVersion={selectedVersion}
            availableVersions={availableVersions}
            docsInfo={docsInfo}
            docAgnosticFormat={docAgnosticFormat}
            sourceUrl={sourceUrl}
        />
    </MuiThemeProvider>,
    document.getElementById('app'),
);