aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/pages/shared
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-11-29 01:16:35 +0800
committerFabio Berger <me@fabioberger.com>2017-11-29 01:16:35 +0800
commit3472bdcfd4ea0a6145dd68972f563e483baf7e6b (patch)
tree6ed8d25cd58cd243aaf94af37f4e9d1d6a98fc85 /packages/website/ts/pages/shared
parent78f0ab36823127b67c1ea24b7245c51ba814b16a (diff)
downloaddexon-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/shared')
-rw-r--r--packages/website/ts/pages/shared/nested_sidebar_menu.tsx8
-rw-r--r--packages/website/ts/pages/shared/version_drop_down.tsx5
2 files changed, 6 insertions, 7 deletions
diff --git a/packages/website/ts/pages/shared/nested_sidebar_menu.tsx b/packages/website/ts/pages/shared/nested_sidebar_menu.tsx
index 69e32aecb..cbb863f3e 100644
--- a/packages/website/ts/pages/shared/nested_sidebar_menu.tsx
+++ b/packages/website/ts/pages/shared/nested_sidebar_menu.tsx
@@ -4,7 +4,7 @@ import {colors} from 'material-ui/styles';
import * as React from 'react';
import {Link as ScrollLink} from 'react-scroll';
import {VersionDropDown} from 'ts/pages/shared/version_drop_down';
-import {Docs, MenuSubsectionsBySection, Styles, ZeroExJsDocSections} from 'ts/types';
+import {Docs, MenuSubsectionsBySection, Styles} from 'ts/types';
import {constants} from 'ts/utils/constants';
import {typeDocUtils} from 'ts/utils/typedoc_utils';
import {utils} from 'ts/utils/utils';
@@ -16,7 +16,7 @@ interface NestedSidebarMenuProps {
onMenuItemClick?: () => void;
selectedVersion?: string;
versions?: string[];
- doc?: Docs;
+ docPath?: string;
isSectionHeaderClickable?: boolean;
}
@@ -77,11 +77,11 @@ export class NestedSidebarMenu extends React.Component<NestedSidebarMenuProps, N
<div>
{!_.isUndefined(this.props.versions) &&
!_.isUndefined(this.props.selectedVersion) &&
- !_.isUndefined(this.props.doc) &&
+ !_.isUndefined(this.props.docPath) &&
<VersionDropDown
selectedVersion={this.props.selectedVersion}
versions={this.props.versions}
- doc={this.props.doc}
+ docPath={this.props.docPath}
/>
}
{navigation}
diff --git a/packages/website/ts/pages/shared/version_drop_down.tsx b/packages/website/ts/pages/shared/version_drop_down.tsx
index 8f4f1a35b..4af9a834f 100644
--- a/packages/website/ts/pages/shared/version_drop_down.tsx
+++ b/packages/website/ts/pages/shared/version_drop_down.tsx
@@ -8,7 +8,7 @@ import {constants} from 'ts/utils/constants';
interface VersionDropDownProps {
selectedVersion: string;
versions: string[];
- doc: Docs;
+ docPath: string;
}
interface VersionDropDownState {}
@@ -40,7 +40,6 @@ export class VersionDropDown extends React.Component<VersionDropDownProps, Versi
return items;
}
private updateSelectedVersion(e: any, index: number, value: string) {
- const docPath = constants.docToPath[this.props.doc];
- window.location.href = `${docPath}/${value}${window.location.hash}`;
+ window.location.href = `${this.props.docPath}/${value}${window.location.hash}`;
}
}