[WIP] new tools

This commit is contained in:
Piotr Janosz
2019-08-13 15:03:51 +02:00
committed by fabioberger
parent ffdb5c06f6
commit fdbc235fd6
13 changed files with 219 additions and 172 deletions

View File

@@ -49,19 +49,20 @@ export const DocsPage: React.FC<IDocsPageProps> = props => {
const { Component, contents, wasNotFound } = state;
const isLoading = !Component && !wasNotFound;
const { page, type } = props.match.params;
const { page, type, version } = props.match.params;
const { hash } = props.location;
// For api explorer / core-concepts the url does not include the page, i.e. it's only 'docs/core-concepts'
const key = page ? page : type;
const { subtitle, title } = meta[page];
const { path, subtitle, title, versions } = meta[key];
React.useEffect(() => {
void loadPageAsync(page, type);
}, [page, type]);
void loadPageAsync(path);
}, [path]);
const loadPageAsync = async (fileName: string, dirName: string) => {
const loadPageAsync = async (path: string) => {
try {
const component = await import(`../../../mdx/${dirName}/${fileName}.mdx`);
// const component = await import(`../../../mdx/tools/@0x/asset-buyer/v6.1.11/reference.mdx`);
const component = await import(`mdx/${path}`);
setState({
...state,
@@ -125,7 +126,7 @@ export const DocsPage: React.FC<IDocsPageProps> = props => {
</MDXProvider>
<NewsletterWidget />
<HelpCallout />
<HelpfulCta page={page} />
<HelpfulCta page={key} />
</ContentWrapper>
</Columns>
)}