import { colors, NestedSidebarMenu } from '@0xproject/react-shared'; import { ObjectMap } from '@0xproject/types'; import * as _ from 'lodash'; import Drawer from 'material-ui/Drawer'; import * as React from 'react'; import { DocsLogo } from 'ts/components/documentation/docs_logo'; import { Container } from 'ts/components/ui/container'; import { Link } from 'ts/components/ui/link'; import { ALink, Deco, Key, WebsitePaths } from 'ts/types'; import { constants } from 'ts/utils/constants'; import { Translate } from 'ts/utils/translate'; export interface DocsContentTopBarProps { location: Location; translate: Translate; sectionNameToLinks?: ObjectMap; } interface DocsContentTopBarState { isDrawerOpen: boolean; } interface MenuItemInfo { title: string; url: string; iconUrl: string; textStyle: React.CSSProperties; } export class DocsContentTopBar extends React.Component { constructor(props: DocsContentTopBarProps) { super(props); this.state = { isDrawerOpen: false, }; } public componentWillReceiveProps(nextProps: DocsContentTopBarProps): void { if (nextProps.location.pathname !== this.props.location.pathname) { this.setState({ isDrawerOpen: false, }); } } public render(): React.ReactNode { const menuItemInfos: MenuItemInfo[] = [ { title: this.props.translate.get(Key.Github, Deco.Cap), url: constants.URL_GITHUB_ORG, iconUrl: '/images/developers/github_icon.svg', textStyle: { color: colors.linkSectionGrey }, }, { title: this.props.translate.get(Key.Forum, Deco.Cap), url: constants.URL_FORUM, iconUrl: '/images/developers/forum_icon.svg', textStyle: { color: colors.linkSectionGrey }, }, { title: this.props.translate.get(Key.LiveChat, Deco.Cap), url: constants.URL_ZEROEX_CHAT, iconUrl: '/images/developers/chat_icon.svg', textStyle: { color: colors.lightLinkBlue, fontWeight: 'bold' }, }, ]; return (
0xproject.com
{this._renderMenuItems(menuItemInfos)}
{this._renderDrawer()} ); } private _renderMenuItems(menuItemInfos: MenuItemInfo[]): React.ReactNode { const menuItems = _.map(menuItemInfos, menuItemInfo => { return (
{menuItemInfo.title}
); }); return menuItems; } private _renderDrawer(): React.ReactNode { return (
TODO {/* */}
); } private _onMenuButtonClick(): void { this.setState({ isDrawerOpen: !this.state.isDrawerOpen, }); } }