import { ALink, colors, Link, 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 { Text } from 'ts/components/ui/text'; import { Deco, Key, WebsitePaths } from 'ts/types'; import { constants } from 'ts/utils/constants'; import { Translate } from 'ts/utils/translate'; export interface DocsTopBarProps { location: Location; translate: Translate; sectionNameToLinks?: ObjectMap; } interface DocsTopBarState { isDrawerOpen: boolean; } interface MenuItemInfo { title: string; url: string; iconUrl: string; fontColor: string; fontWeight?: string; } export class DocsTopBar extends React.Component { constructor(props: DocsTopBarProps) { super(props); this.state = { isDrawerOpen: false, }; } public componentWillReceiveProps(nextProps: DocsTopBarProps): 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', fontColor: colors.linkSectionGrey, }, { title: this.props.translate.get(Key.Forum, Deco.Cap), url: constants.URL_FORUM, iconUrl: '/images/developers/forum_icon.svg', fontColor: colors.linkSectionGrey, }, { title: this.props.translate.get(Key.LiveChat, Deco.Cap), url: constants.URL_ZEROEX_CHAT, iconUrl: '/images/developers/chat_icon.svg', fontColor: 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 ( ); } private _onMenuButtonClick(): void { this.setState({ isDrawerOpen: !this.state.isDrawerOpen, }); } }