aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/pages/shared/nested_sidebar_menu.tsx
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-01-25 23:42:58 +0800
committerFabio Berger <me@fabioberger.com>2018-01-25 23:42:58 +0800
commit71d68f975cd7bc089f0cbef4e5888a73eab4ee42 (patch)
tree9482602fc23d2baec3fff1fb97750ad45adc6eca /packages/website/ts/pages/shared/nested_sidebar_menu.tsx
parentec3d8a034fe763d8255935985b1fb97aff6c177b (diff)
parentf58f0ddb67555c3f0c7252ea3e003824984c48ad (diff)
downloaddexon-0x-contracts-71d68f975cd7bc089f0cbef4e5888a73eab4ee42.tar.gz
dexon-0x-contracts-71d68f975cd7bc089f0cbef4e5888a73eab4ee42.tar.zst
dexon-0x-contracts-71d68f975cd7bc089f0cbef4e5888a73eab4ee42.zip
Merge branch 'development' into feature/portal-ledger-support
* development: (437 commits) Publish Update yarn.lock Update the CHANGELOG Fix the bug making it impossible to specify the custom ZRX address Fix fill/cancel order by looking for NoError instead of empty blockchainErr given the BlockchainErrs type refactor Add a comment about a yarn bug Add our mainnet and kovan nodes as backups for Portal requests Fix bug hiding the user info from topBar Add dev-utils package to top level README Prettier newline Prettier Allow Token symbols to be alphanumeric Update CHANGELOG, rebase on development Should not -> cannot Reject negative amounts in isValidBaseUnitAmount Re-add changelog for 0x.js Fix prettier Update yarn.lock Move tests to a separate folder Change file layout ... # Conflicts: # packages/website/README.md
Diffstat (limited to 'packages/website/ts/pages/shared/nested_sidebar_menu.tsx')
-rw-r--r--packages/website/ts/pages/shared/nested_sidebar_menu.tsx127
1 files changed, 59 insertions, 68 deletions
diff --git a/packages/website/ts/pages/shared/nested_sidebar_menu.tsx b/packages/website/ts/pages/shared/nested_sidebar_menu.tsx
index cbb863f3e..849c33504 100644
--- a/packages/website/ts/pages/shared/nested_sidebar_menu.tsx
+++ b/packages/website/ts/pages/shared/nested_sidebar_menu.tsx
@@ -1,16 +1,15 @@
import * as _ from 'lodash';
import MenuItem from 'material-ui/MenuItem';
-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} from 'ts/types';
-import {constants} from 'ts/utils/constants';
-import {typeDocUtils} from 'ts/utils/typedoc_utils';
-import {utils} from 'ts/utils/utils';
+import { Link as ScrollLink } from 'react-scroll';
+import { VersionDropDown } from 'ts/pages/shared/version_drop_down';
+import { MenuSubsectionsBySection, Styles } from 'ts/types';
+import { colors } from 'ts/utils/colors';
+import { constants } from 'ts/utils/constants';
+import { utils } from 'ts/utils/utils';
interface NestedSidebarMenuProps {
- topLevelMenu: {[topLevel: string]: string[]};
+ topLevelMenu: { [topLevel: string]: string[] };
menuSubsectionsBySection: MenuSubsectionsBySection;
shouldDisplaySectionHeaders?: boolean;
onMenuItemClick?: () => void;
@@ -45,55 +44,44 @@ export class NestedSidebarMenu extends React.Component<NestedSidebarMenuProps, N
if (this.props.shouldDisplaySectionHeaders) {
const id = utils.getIdFromName(sectionName);
return (
- <div
- key={`section-${sectionName}`}
- className="py1"
- >
+ <div key={`section-${sectionName}`} className="py1">
<ScrollLink
to={id}
offset={-20}
duration={constants.DOCS_SCROLL_DURATION_MS}
containerId={constants.DOCS_CONTAINER_ID}
>
- <div
- style={{color: colors.grey500, cursor: 'pointer'}}
- className="pb1"
- >
+ <div style={{ color: colors.grey, cursor: 'pointer' }} className="pb1">
{finalSectionName.toUpperCase()}
</div>
</ScrollLink>
- {this.renderMenuItems(menuItems)}
+ {this._renderMenuItems(menuItems)}
</div>
);
} else {
- return (
- <div key={`section-${sectionName}`} >
- {this.renderMenuItems(menuItems)}
- </div>
- );
+ return <div key={`section-${sectionName}`}>{this._renderMenuItems(menuItems)}</div>;
}
});
return (
<div>
{!_.isUndefined(this.props.versions) &&
- !_.isUndefined(this.props.selectedVersion) &&
- !_.isUndefined(this.props.docPath) &&
- <VersionDropDown
- selectedVersion={this.props.selectedVersion}
- versions={this.props.versions}
- docPath={this.props.docPath}
- />
- }
+ !_.isUndefined(this.props.selectedVersion) &&
+ !_.isUndefined(this.props.docPath) && (
+ <VersionDropDown
+ selectedVersion={this.props.selectedVersion}
+ versions={this.props.versions}
+ docPath={this.props.docPath}
+ />
+ )}
{navigation}
</div>
);
}
- private renderMenuItems(menuItemNames: string[]): React.ReactNode[] {
- const menuItemStyles = this.props.shouldDisplaySectionHeaders ?
- styles.menuItemWithHeaders :
- styles.menuItemWithoutHeaders;
- const menuItemInnerDivStyles = this.props.shouldDisplaySectionHeaders ?
- styles.menuItemInnerDivWithHeaders : {};
+ private _renderMenuItems(menuItemNames: string[]): React.ReactNode[] {
+ const menuItemStyles = this.props.shouldDisplaySectionHeaders
+ ? styles.menuItemWithHeaders
+ : styles.menuItemWithoutHeaders;
+ const menuItemInnerDivStyles = this.props.shouldDisplaySectionHeaders ? styles.menuItemInnerDivWithHeaders : {};
const menuItems = _.map(menuItemNames, menuItemName => {
const id = utils.getIdFromName(menuItemName);
return (
@@ -106,57 +94,60 @@ export class NestedSidebarMenu extends React.Component<NestedSidebarMenuProps, N
containerId={constants.DOCS_CONTAINER_ID}
>
<MenuItem
- onTouchTap={this.onMenuItemClick.bind(this, menuItemName)}
+ onTouchTap={this._onMenuItemClick.bind(this, menuItemName)}
style={menuItemStyles}
innerDivStyle={menuItemInnerDivStyles}
>
- <span style={{textTransform: 'capitalize'}}>
- {menuItemName}
- </span>
+ <span style={{ textTransform: 'capitalize' }}>{menuItemName}</span>
</MenuItem>
</ScrollLink>
- {this.renderMenuItemSubsections(menuItemName)}
+ {this._renderMenuItemSubsections(menuItemName)}
</div>
);
});
return menuItems;
}
- private renderMenuItemSubsections(menuItemName: string): React.ReactNode {
+ private _renderMenuItemSubsections(menuItemName: string): React.ReactNode {
if (_.isUndefined(this.props.menuSubsectionsBySection[menuItemName])) {
return null;
}
- return this.renderMenuSubsectionsBySection(menuItemName, this.props.menuSubsectionsBySection[menuItemName]);
+ return this._renderMenuSubsectionsBySection(menuItemName, this.props.menuSubsectionsBySection[menuItemName]);
}
- private renderMenuSubsectionsBySection(menuItemName: string, entityNames: string[]): React.ReactNode {
+ private _renderMenuSubsectionsBySection(menuItemName: string, entityNames: string[]): React.ReactNode {
return (
- <ul style={{margin: 0, listStyleType: 'none', paddingLeft: 0}} key={menuItemName}>
- {_.map(entityNames, entityName => {
- const id = utils.getIdFromName(entityName);
- return (
- <li key={`menuItem-${entityName}`}>
- <ScrollLink
- to={id}
- offset={0}
- duration={constants.DOCS_SCROLL_DURATION_MS}
- containerId={constants.DOCS_CONTAINER_ID}
- onTouchTap={this.onMenuItemClick.bind(this, entityName)}
- >
- <MenuItem
- onTouchTap={this.onMenuItemClick.bind(this, menuItemName)}
- style={{minHeight: 35}}
- innerDivStyle={{paddingLeft: 36, fontSize: 14, lineHeight: '35px'}}
+ <ul style={{ margin: 0, listStyleType: 'none', paddingLeft: 0 }} key={menuItemName}>
+ {_.map(entityNames, entityName => {
+ const name = `${menuItemName}-${entityName}`;
+ const id = utils.getIdFromName(name);
+ return (
+ <li key={`menuItem-${entityName}`}>
+ <ScrollLink
+ to={id}
+ offset={0}
+ duration={constants.DOCS_SCROLL_DURATION_MS}
+ containerId={constants.DOCS_CONTAINER_ID}
+ onTouchTap={this._onMenuItemClick.bind(this, name)}
>
- {entityName}
- </MenuItem>
- </ScrollLink>
- </li>
- );
- })}
+ <MenuItem
+ onTouchTap={this._onMenuItemClick.bind(this, name)}
+ style={{ minHeight: 35 }}
+ innerDivStyle={{
+ paddingLeft: 36,
+ fontSize: 14,
+ lineHeight: '35px',
+ }}
+ >
+ {entityName}
+ </MenuItem>
+ </ScrollLink>
+ </li>
+ );
+ })}
</ul>
);
}
- private onMenuItemClick(menuItemName: string): void {
- const id = utils.getIdFromName(menuItemName);
+ private _onMenuItemClick(name: string): void {
+ const id = utils.getIdFromName(name);
utils.setUrlHash(id);
this.props.onMenuItemClick();
}