From c07412a992284b2f3045be1c620ea2e0a351139a Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 2 Oct 2018 20:10:59 +0100 Subject: Use new Link UI component everywhere, and add complementary ALink type --- packages/website/ts/components/footer.tsx | 95 +++++++++++++------------------ 1 file changed, 38 insertions(+), 57 deletions(-) (limited to 'packages/website/ts/components/footer.tsx') diff --git a/packages/website/ts/components/footer.tsx b/packages/website/ts/components/footer.tsx index 6dcb5a0e9..bec3c17f7 100644 --- a/packages/website/ts/components/footer.tsx +++ b/packages/website/ts/components/footer.tsx @@ -1,24 +1,16 @@ import { colors } from '@0xproject/react-shared'; +import { ObjectMap } from '@0xproject/types'; import * as _ from 'lodash'; import DropDownMenu from 'material-ui/DropDownMenu'; import MenuItem from 'material-ui/MenuItem'; import * as React from 'react'; -import { Link } from 'react-router-dom'; +import { Link } from 'ts/components/ui/link'; + import { Dispatcher } from 'ts/redux/dispatcher'; -import { Deco, Key, Language, WebsitePaths } from 'ts/types'; +import { ALink, Deco, Key, Language, LinkType, WebsitePaths } from 'ts/types'; import { constants } from 'ts/utils/constants'; import { Translate } from 'ts/utils/translate'; -interface MenuItemsBySection { - [sectionName: string]: FooterMenuItem[]; -} - -interface FooterMenuItem { - title: string; - path?: string; - isExternal?: boolean; -} - const ICON_DIMENSION = 16; const linkStyle = { @@ -51,76 +43,74 @@ export class Footer extends React.Component { }; } public render(): React.ReactNode { - const menuItemsBySection: MenuItemsBySection = { + const sectionNameToLinks: ObjectMap = { [Key.Documentation]: [ { title: '0x.js', - path: WebsitePaths.ZeroExJs, + to: WebsitePaths.ZeroExJs, }, { title: this.props.translate.get(Key.SmartContracts, Deco.Cap), - path: WebsitePaths.SmartContracts, + to: WebsitePaths.SmartContracts, }, { title: this.props.translate.get(Key.Connect, Deco.Cap), - path: WebsitePaths.Connect, + to: WebsitePaths.Connect, }, { title: this.props.translate.get(Key.Whitepaper, Deco.Cap), - path: WebsitePaths.Whitepaper, - isExternal: true, + to: WebsitePaths.Whitepaper, + type: LinkType.External, }, { title: this.props.translate.get(Key.Wiki, Deco.Cap), - path: WebsitePaths.Wiki, + to: WebsitePaths.Wiki, }, { title: this.props.translate.get(Key.Faq, Deco.Cap), - path: WebsitePaths.FAQ, + to: WebsitePaths.FAQ, }, ], [Key.Community]: [ { title: this.props.translate.get(Key.RocketChat, Deco.Cap), - isExternal: true, - path: constants.URL_ZEROEX_CHAT, + type: LinkType.External, + to: constants.URL_ZEROEX_CHAT, }, { title: this.props.translate.get(Key.Blog, Deco.Cap), - isExternal: true, - path: constants.URL_BLOG, + type: LinkType.External, + to: constants.URL_BLOG, }, { title: 'Twitter', - isExternal: true, - path: constants.URL_TWITTER, + type: LinkType.External, + to: constants.URL_TWITTER, }, { title: 'Reddit', - isExternal: true, - path: constants.URL_REDDIT, + type: LinkType.External, + to: constants.URL_REDDIT, }, { title: this.props.translate.get(Key.Forum, Deco.Cap), - isExternal: true, - path: constants.URL_DISCOURSE_FORUM, + type: LinkType.External, + to: constants.URL_DISCOURSE_FORUM, }, ], [Key.Organization]: [ { title: this.props.translate.get(Key.About, Deco.Cap), - isExternal: false, - path: WebsitePaths.About, + to: WebsitePaths.About, }, { title: this.props.translate.get(Key.Careers, Deco.Cap), - isExternal: false, - path: WebsitePaths.Careers, + to: WebsitePaths.Careers, }, { title: this.props.translate.get(Key.Contact, Deco.Cap), - isExternal: true, - path: 'mailto:team@0xproject.com', + type: LinkType.External, + to: 'mailto:team@0xproject.com', }, ], }; @@ -160,19 +150,19 @@ export class Footer extends React.Component {
{this._renderHeader(Key.Documentation)} - {_.map(menuItemsBySection[Key.Documentation], this._renderMenuItem.bind(this))} + {_.map(sectionNameToLinks[Key.Documentation], this._renderMenuItem.bind(this))}
{this._renderHeader(Key.Community)} - {_.map(menuItemsBySection[Key.Community], this._renderMenuItem.bind(this))} + {_.map(sectionNameToLinks[Key.Community], this._renderMenuItem.bind(this))}
{this._renderHeader(Key.Organization)} - {_.map(menuItemsBySection[Key.Organization], this._renderMenuItem.bind(this))} + {_.map(sectionNameToLinks[Key.Organization], this._renderMenuItem.bind(this))}
@@ -187,7 +177,7 @@ export class Footer extends React.Component { ); } - private _renderMenuItem(item: FooterMenuItem): React.ReactNode { + private _renderMenuItem(link: ALink): React.ReactNode { const titleToIcon: { [title: string]: string } = { [this.props.translate.get(Key.RocketChat, Deco.Cap)]: 'rocketchat.png', [this.props.translate.get(Key.Blog, Deco.Cap)]: 'medium.png', @@ -195,30 +185,21 @@ export class Footer extends React.Component { Reddit: 'reddit.png', [this.props.translate.get(Key.Forum, Deco.Cap)]: 'discourse.png', }; - const iconIfExists = titleToIcon[item.title]; + const iconIfExists = titleToIcon[link.title]; return ( -
- {item.isExternal ? ( - +
+ +
{!_.isUndefined(iconIfExists) ? (
{this._renderIcon(iconIfExists)}
-
{item.title}
+
{link.title}
) : ( - item.title + link.title )} -
- ) : ( - -
- {!_.isUndefined(iconIfExists) && ( -
{this._renderIcon(iconIfExists)}
- )} - {item.title} -
- - )} +
+
); } -- cgit v1.2.3 From 437612f8b8c28fb384698c5c2b331e173cee8767 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 3 Oct 2018 16:37:59 +0100 Subject: Use same Link UI component for react-scroll links --- packages/website/ts/components/footer.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'packages/website/ts/components/footer.tsx') diff --git a/packages/website/ts/components/footer.tsx b/packages/website/ts/components/footer.tsx index bec3c17f7..02770c073 100644 --- a/packages/website/ts/components/footer.tsx +++ b/packages/website/ts/components/footer.tsx @@ -1,13 +1,12 @@ -import { colors } from '@0xproject/react-shared'; +import { ALink, colors, Link, LinkType } from '@0xproject/react-shared'; import { ObjectMap } from '@0xproject/types'; import * as _ from 'lodash'; import DropDownMenu from 'material-ui/DropDownMenu'; import MenuItem from 'material-ui/MenuItem'; import * as React from 'react'; -import { Link } from 'ts/components/ui/link'; import { Dispatcher } from 'ts/redux/dispatcher'; -import { ALink, Deco, Key, Language, LinkType, WebsitePaths } from 'ts/types'; +import { Deco, Key, Language, WebsitePaths } from 'ts/types'; import { constants } from 'ts/utils/constants'; import { Translate } from 'ts/utils/translate'; -- cgit v1.2.3 From 5f2cd33da07a7acc65f2e05acb35755f74af75a4 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 5 Oct 2018 13:54:37 +0100 Subject: Remove style prop from Link --- packages/website/ts/components/footer.tsx | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'packages/website/ts/components/footer.tsx') diff --git a/packages/website/ts/components/footer.tsx b/packages/website/ts/components/footer.tsx index 02770c073..d90f2f708 100644 --- a/packages/website/ts/components/footer.tsx +++ b/packages/website/ts/components/footer.tsx @@ -12,11 +12,6 @@ import { Translate } from 'ts/utils/translate'; const ICON_DIMENSION = 16; -const linkStyle = { - color: colors.white, - cursor: 'pointer', -}; - const languageToMenuTitle = { [Language.English]: 'English', [Language.Russian]: 'Русский', @@ -187,7 +182,7 @@ export class Footer extends React.Component { const iconIfExists = titleToIcon[link.title]; return (
- +
{!_.isUndefined(iconIfExists) ? (
-- cgit v1.2.3 From fa6bd348992674192d07fef3d60950980212ecbb Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 5 Oct 2018 14:55:28 +0100 Subject: Remove type prop and instead infer it from the value of to --- packages/website/ts/components/footer.tsx | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'packages/website/ts/components/footer.tsx') diff --git a/packages/website/ts/components/footer.tsx b/packages/website/ts/components/footer.tsx index d90f2f708..f11ecae19 100644 --- a/packages/website/ts/components/footer.tsx +++ b/packages/website/ts/components/footer.tsx @@ -1,4 +1,4 @@ -import { ALink, colors, Link, LinkType } from '@0xproject/react-shared'; +import { ALink, colors, Link } from '@0xproject/react-shared'; import { ObjectMap } from '@0xproject/types'; import * as _ from 'lodash'; import DropDownMenu from 'material-ui/DropDownMenu'; @@ -54,7 +54,7 @@ export class Footer extends React.Component { { title: this.props.translate.get(Key.Whitepaper, Deco.Cap), to: WebsitePaths.Whitepaper, - type: LinkType.External, + shouldOpenInNewTab: true, }, { title: this.props.translate.get(Key.Wiki, Deco.Cap), @@ -68,28 +68,28 @@ export class Footer extends React.Component { [Key.Community]: [ { title: this.props.translate.get(Key.RocketChat, Deco.Cap), - type: LinkType.External, to: constants.URL_ZEROEX_CHAT, + shouldOpenInNewTab: true, }, { title: this.props.translate.get(Key.Blog, Deco.Cap), - type: LinkType.External, to: constants.URL_BLOG, + shouldOpenInNewTab: true, }, { title: 'Twitter', - type: LinkType.External, to: constants.URL_TWITTER, + shouldOpenInNewTab: true, }, { title: 'Reddit', - type: LinkType.External, to: constants.URL_REDDIT, + shouldOpenInNewTab: true, }, { title: this.props.translate.get(Key.Forum, Deco.Cap), - type: LinkType.External, to: constants.URL_DISCOURSE_FORUM, + shouldOpenInNewTab: true, }, ], [Key.Organization]: [ @@ -103,8 +103,8 @@ export class Footer extends React.Component { }, { title: this.props.translate.get(Key.Contact, Deco.Cap), - type: LinkType.External, to: 'mailto:team@0xproject.com', + shouldOpenInNewTab: true, }, ], }; @@ -182,7 +182,12 @@ export class Footer extends React.Component { const iconIfExists = titleToIcon[link.title]; return (
- +
{!_.isUndefined(iconIfExists) ? (
-- cgit v1.2.3 From ad235912d7c7fc618d7adf6c8568d723da812d66 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 16 Oct 2018 14:35:33 +0100 Subject: chore: Replace FAQ with Developer home in footer --- packages/website/ts/components/footer.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'packages/website/ts/components/footer.tsx') diff --git a/packages/website/ts/components/footer.tsx b/packages/website/ts/components/footer.tsx index f11ecae19..db4f57100 100644 --- a/packages/website/ts/components/footer.tsx +++ b/packages/website/ts/components/footer.tsx @@ -39,6 +39,10 @@ export class Footer extends React.Component { public render(): React.ReactNode { const sectionNameToLinks: ObjectMap = { [Key.Documentation]: [ + { + title: 'Developer Home', + to: WebsitePaths.Docs, + }, { title: '0x.js', to: WebsitePaths.ZeroExJs, @@ -60,10 +64,6 @@ export class Footer extends React.Component { title: this.props.translate.get(Key.Wiki, Deco.Cap), to: WebsitePaths.Wiki, }, - { - title: this.props.translate.get(Key.Faq, Deco.Cap), - to: WebsitePaths.FAQ, - }, ], [Key.Community]: [ { -- cgit v1.2.3 From 0affc7682fa1a7484bb77cc460e9b9d10553980f Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 18 Oct 2018 14:06:12 +0100 Subject: chore: fix imports --- packages/website/ts/components/footer.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'packages/website/ts/components/footer.tsx') diff --git a/packages/website/ts/components/footer.tsx b/packages/website/ts/components/footer.tsx index db4f57100..dfedcba55 100644 --- a/packages/website/ts/components/footer.tsx +++ b/packages/website/ts/components/footer.tsx @@ -1,5 +1,5 @@ -import { ALink, colors, Link } from '@0xproject/react-shared'; -import { ObjectMap } from '@0xproject/types'; +import { ALink, colors, Link } from '@0x/react-shared'; +import { ObjectMap } from '@0x/types'; import * as _ from 'lodash'; import DropDownMenu from 'material-ui/DropDownMenu'; import MenuItem from 'material-ui/MenuItem'; -- cgit v1.2.3