aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-10-05 21:55:28 +0800
committerFabio Berger <me@fabioberger.com>2018-10-05 21:55:28 +0800
commitfa6bd348992674192d07fef3d60950980212ecbb (patch)
tree7b8fb8323c972291ddb1c77bc45f73bf39a8f805 /packages/website
parent5f2cd33da07a7acc65f2e05acb35755f74af75a4 (diff)
downloaddexon-0x-contracts-fa6bd348992674192d07fef3d60950980212ecbb.tar.gz
dexon-0x-contracts-fa6bd348992674192d07fef3d60950980212ecbb.tar.zst
dexon-0x-contracts-fa6bd348992674192d07fef3d60950980212ecbb.zip
Remove type prop and instead infer it from the value of to
Diffstat (limited to 'packages/website')
-rw-r--r--packages/website/package.json2
-rw-r--r--packages/website/ts/components/dialogs/blockchain_err_dialog.tsx2
-rw-r--r--packages/website/ts/components/dropdowns/developers_drop_down.tsx10
-rw-r--r--packages/website/ts/components/footer.tsx23
-rw-r--r--packages/website/ts/components/top_bar/top_bar.tsx16
-rw-r--r--packages/website/ts/components/top_bar/top_bar_menu_item.tsx7
-rw-r--r--packages/website/ts/pages/documentation/home.tsx21
-rw-r--r--packages/website/ts/pages/wiki/wiki.tsx2
8 files changed, 28 insertions, 55 deletions
diff --git a/packages/website/package.json b/packages/website/package.json
index 3073eca72..89135b4f9 100644
--- a/packages/website/package.json
+++ b/packages/website/package.json
@@ -62,6 +62,7 @@
"styled-components": "^3.3.0",
"thenby": "^1.2.3",
"truffle-contract": "2.0.1",
+ "valid-url": "^1.0.9",
"web3-provider-engine": "14.0.6",
"xml-js": "^1.6.4"
},
@@ -84,6 +85,7 @@
"@types/react-scroll": "1.5.3",
"@types/react-tap-event-plugin": "0.0.30",
"@types/redux": "^3.6.0",
+ "@types/valid-url": "^1.0.2",
"@types/web3-provider-engine": "^14.0.0",
"awesome-typescript-loader": "^5.2.1",
"copyfiles": "^2.0.0",
diff --git a/packages/website/ts/components/dialogs/blockchain_err_dialog.tsx b/packages/website/ts/components/dialogs/blockchain_err_dialog.tsx
index 18c060991..d50fd6592 100644
--- a/packages/website/ts/components/dialogs/blockchain_err_dialog.tsx
+++ b/packages/website/ts/components/dialogs/blockchain_err_dialog.tsx
@@ -1,4 +1,4 @@
-import { colors, Networks } from '@0xproject/react-shared';
+import { colors, Link, Networks } from '@0xproject/react-shared';
import Dialog from 'material-ui/Dialog';
import FlatButton from 'material-ui/FlatButton';
import * as React from 'react';
diff --git a/packages/website/ts/components/dropdowns/developers_drop_down.tsx b/packages/website/ts/components/dropdowns/developers_drop_down.tsx
index e3039420e..8a5ad53e2 100644
--- a/packages/website/ts/components/dropdowns/developers_drop_down.tsx
+++ b/packages/website/ts/components/dropdowns/developers_drop_down.tsx
@@ -1,4 +1,4 @@
-import { ALink, colors, Link, LinkType } from '@0xproject/react-shared';
+import { ALink, colors, Link } from '@0xproject/react-shared';
import * as _ from 'lodash';
import * as React from 'react';
import { Container } from 'ts/components/ui/container';
@@ -46,19 +46,16 @@ const usefulLinksToLinkInfo: ALink[] = [
{
title: Key.Github,
to: constants.URL_GITHUB_ORG,
- type: LinkType.External,
shouldOpenInNewTab: true,
},
{
title: Key.Whitepaper,
to: WebsitePaths.Whitepaper,
- type: LinkType.External,
shouldOpenInNewTab: true,
},
{
title: Key.Sandbox,
to: constants.URL_SANDBOX,
- type: LinkType.External,
shouldOpenInNewTab: true,
},
];
@@ -160,17 +157,16 @@ export class DevelopersDropDown extends React.Component<DevelopersDropDownProps,
const isWikiLink = _.startsWith(link.to, WebsitePaths.Wiki) && _.includes(link.to, '#');
const isOnWiki = this.props.location.pathname === WebsitePaths.Wiki;
let to = link.to;
- let type = link.type;
+ const type = link.type;
if (isWikiLink && isOnWiki) {
to = `${link.to.split('#')[1]}`;
- type = LinkType.ReactScroll;
}
i++;
const isLast = i === numLinks;
const linkText = this.props.translate.get(link.title as Key, Deco.Cap);
return (
<div className={`pr1 pt1 ${!isLast && 'pb1'}`} key={`dev-dropdown-link-${link.title}`}>
- <Link to={to} type={type} shouldOpenInNewTab={!!link.shouldOpenInNewTab}>
+ <Link to={to} shouldOpenInNewTab={!!link.shouldOpenInNewTab}>
<Text fontFamily="Roboto, Roboto Mono" fontColor={colors.lightBlueA700}>
{linkText}
</Text>
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<FooterProps, FooterState> {
{
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<FooterProps, FooterState> {
[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<FooterProps, FooterState> {
},
{
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<FooterProps, FooterState> {
const iconIfExists = titleToIcon[link.title];
return (
<div key={link.title} className="sm-center" style={{ fontSize: 13, paddingTop: 25 }}>
- <Link to={link.to} type={link.type} fontColor={colors.white} className="text-decoration-none">
+ <Link
+ to={link.to}
+ shouldOpenInNewTab={link.shouldOpenInNewTab}
+ fontColor={colors.white}
+ className="text-decoration-none"
+ >
<div>
{!_.isUndefined(iconIfExists) ? (
<div className="inline-block">
diff --git a/packages/website/ts/components/top_bar/top_bar.tsx b/packages/website/ts/components/top_bar/top_bar.tsx
index d05b72d98..3297befad 100644
--- a/packages/website/ts/components/top_bar/top_bar.tsx
+++ b/packages/website/ts/components/top_bar/top_bar.tsx
@@ -1,13 +1,5 @@
import { DocsInfo } from '@0xproject/react-docs';
-import {
- ALink,
- colors,
- constants as sharedConstants,
- Link,
- LinkType,
- NestedSidebarMenu,
- Styles,
-} from '@0xproject/react-shared';
+import { ALink, colors, constants as sharedConstants, Link, NestedSidebarMenu, Styles } from '@0xproject/react-shared';
import { ObjectMap } from '@0xproject/types';
import * as _ from 'lodash';
import Drawer from 'material-ui/Drawer';
@@ -177,7 +169,7 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
path={constants.URL_BLOG}
style={styles.menuItem}
isNightVersion={isNightVersion}
- linkType={LinkType.External}
+ shouldOpenInNewTab={true}
/>
<TopBarMenuItem
title={this.props.translate.get(Key.About, Deco.Cap)}
@@ -285,7 +277,7 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
</MenuItem>
</Link>
)}
- <Link to={WebsitePaths.Whitepaper} type={LinkType.External} shouldOpenInNewTab={true}>
+ <Link to={WebsitePaths.Whitepaper} shouldOpenInNewTab={true}>
<MenuItem className="py2">{this.props.translate.get(Key.Whitepaper, Deco.Cap)}</MenuItem>
</Link>
<Link to={WebsitePaths.About}>
@@ -294,7 +286,7 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
<Link to={WebsitePaths.Careers}>
<MenuItem className="py2">{this.props.translate.get(Key.Careers, Deco.Cap)}</MenuItem>
</Link>
- <Link to={constants.URL_BLOG} type={LinkType.External} shouldOpenInNewTab={true}>
+ <Link to={constants.URL_BLOG} shouldOpenInNewTab={true}>
<MenuItem className="py2">{this.props.translate.get(Key.Blog, Deco.Cap)}</MenuItem>
</Link>
<Link to={WebsitePaths.FAQ}>
diff --git a/packages/website/ts/components/top_bar/top_bar_menu_item.tsx b/packages/website/ts/components/top_bar/top_bar_menu_item.tsx
index c88db95fa..eff5ba66d 100644
--- a/packages/website/ts/components/top_bar/top_bar_menu_item.tsx
+++ b/packages/website/ts/components/top_bar/top_bar_menu_item.tsx
@@ -1,4 +1,4 @@
-import { colors, Link, LinkType } from '@0xproject/react-shared';
+import { colors, Link } from '@0xproject/react-shared';
import * as _ from 'lodash';
import * as React from 'react';
@@ -12,7 +12,7 @@ interface TopBarMenuItemProps {
title: string;
path?: string;
isPrimary?: boolean;
- linkType: LinkType;
+ shouldOpenInNewTab?: boolean;
style?: React.CSSProperties;
className?: string;
isNightVersion?: boolean;
@@ -25,6 +25,7 @@ export class TopBarMenuItem extends React.Component<TopBarMenuItemProps, TopBarM
isPrimary: false,
style: DEFAULT_STYLE,
className: '',
+ shouldOpenInNewTab: false,
isNightVersion: false,
};
public render(): React.ReactNode {
@@ -37,7 +38,7 @@ export class TopBarMenuItem extends React.Component<TopBarMenuItemProps, TopBarM
);
return (
<div className={`center ${this.props.className}`} style={{ ...this.props.style, color: menuItemColor }}>
- <Link to={this.props.path} type={this.props.linkType} fontColor={linkColor}>
+ <Link to={this.props.path} shouldOpenInNewTab={this.props.shouldOpenInNewTab} fontColor={linkColor}>
{itemContent}
</Link>
</div>
diff --git a/packages/website/ts/pages/documentation/home.tsx b/packages/website/ts/pages/documentation/home.tsx
index abe0ae6af..f7c4839b4 100644
--- a/packages/website/ts/pages/documentation/home.tsx
+++ b/packages/website/ts/pages/documentation/home.tsx
@@ -3,7 +3,6 @@ import {
colors,
constants as sharedConstants,
Link,
- LinkType,
MarkdownLinkBlock,
NestedSidebarMenu,
utils as sharedUtils,
@@ -89,7 +88,6 @@ const CATEGORY_TO_PACKAGES: { [category: string]: Package[] } = {
title: '0x starter project',
to: 'https://github.com/0xProject/0x-starter-project',
shouldOpenInNewTab: true,
- type: LinkType.External,
},
},
{
@@ -144,7 +142,6 @@ const CATEGORY_TO_PACKAGES: { [category: string]: Package[] } = {
title: '@0xproject/sra-spec',
to: 'https://github.com/0xProject/0x-monorepo/tree/development/packages/sra-spec',
shouldOpenInNewTab: true,
- type: LinkType.External,
},
},
],
@@ -156,7 +153,6 @@ const CATEGORY_TO_PACKAGES: { [category: string]: Package[] } = {
title: 'abi-gen',
to: 'https://github.com/0xProject/0x-monorepo/tree/development/packages/abi-gen',
shouldOpenInNewTab: true,
- type: LinkType.External,
},
},
{
@@ -213,7 +209,6 @@ const CATEGORY_TO_PACKAGES: { [category: string]: Package[] } = {
title: '0x Event Extractor',
to: 'https://github.com/0xTracker/0x-event-extractor',
shouldOpenInNewTab: true,
- type: LinkType.External,
},
},
{
@@ -223,7 +218,6 @@ const CATEGORY_TO_PACKAGES: { [category: string]: Package[] } = {
title: '0x Tracker Worker',
to: 'https://github.com/0xTracker/0x-tracker-worker',
shouldOpenInNewTab: true,
- type: LinkType.External,
},
},
{
@@ -233,7 +227,6 @@ const CATEGORY_TO_PACKAGES: { [category: string]: Package[] } = {
title: 'Aquaduct',
to: 'https://www.npmjs.com/package/aqueduct',
shouldOpenInNewTab: true,
- type: LinkType.External,
},
},
{
@@ -243,7 +236,6 @@ const CATEGORY_TO_PACKAGES: { [category: string]: Package[] } = {
title: 'Aquaduct Server SDK',
to: 'https://github.com/ERCdEX/aqueduct-server-sdk',
shouldOpenInNewTab: true,
- type: LinkType.External,
},
},
{
@@ -252,7 +244,6 @@ const CATEGORY_TO_PACKAGES: { [category: string]: Package[] } = {
to: 'https://www.npmjs.com/package/ddex-api',
title: 'DDEX Node.js SDK',
shouldOpenInNewTab: true,
- type: LinkType.External,
},
},
{
@@ -261,7 +252,6 @@ const CATEGORY_TO_PACKAGES: { [category: string]: Package[] } = {
to: 'https://github.com/ERCdEX/widget',
title: 'ERCdex Widget',
shouldOpenInNewTab: true,
- type: LinkType.External,
},
},
{
@@ -270,7 +260,6 @@ const CATEGORY_TO_PACKAGES: { [category: string]: Package[] } = {
to: 'https://github.com/ERCdEX/java',
title: 'ERCdex Java SDK',
shouldOpenInNewTab: true,
- type: LinkType.External,
},
},
{
@@ -279,7 +268,6 @@ const CATEGORY_TO_PACKAGES: { [category: string]: Package[] } = {
to: 'https://github.com/ERCdEX/python',
title: 'ERCdex Python SDK',
shouldOpenInNewTab: true,
- type: LinkType.External,
},
},
{
@@ -289,7 +277,6 @@ const CATEGORY_TO_PACKAGES: { [category: string]: Package[] } = {
title: 'Massive',
to: 'https://github.com/NoteGio/massive',
shouldOpenInNewTab: true,
- type: LinkType.External,
},
},
{
@@ -298,7 +285,6 @@ const CATEGORY_TO_PACKAGES: { [category: string]: Package[] } = {
to: 'https://github.com/NoteGio/openrelay',
title: 'OpenRelay',
shouldOpenInNewTab: true,
- type: LinkType.External,
},
},
{
@@ -308,7 +294,6 @@ const CATEGORY_TO_PACKAGES: { [category: string]: Package[] } = {
title: 'OpenRelay.js',
to: 'https://github.com/NoteGio/openrelay.js',
shouldOpenInNewTab: true,
- type: LinkType.External,
},
},
{
@@ -318,7 +303,6 @@ const CATEGORY_TO_PACKAGES: { [category: string]: Package[] } = {
title: 'Radar SDK',
to: 'https://github.com/RadarRelay/sdk',
shouldOpenInNewTab: true,
- type: LinkType.External,
},
},
{
@@ -328,7 +312,6 @@ const CATEGORY_TO_PACKAGES: { [category: string]: Package[] } = {
title: 'The Ocean Javascript SDK',
to: 'https://github.com/TheOceanTrade/theoceanx-javascript',
shouldOpenInNewTab: true,
- type: LinkType.External,
},
},
{
@@ -337,7 +320,6 @@ const CATEGORY_TO_PACKAGES: { [category: string]: Package[] } = {
to: 'https://www.npmjs.com/package/tokenlon-sdk',
title: 'Tokenlon Javascript SDK',
shouldOpenInNewTab: true,
- type: LinkType.External,
},
},
{
@@ -346,7 +328,6 @@ const CATEGORY_TO_PACKAGES: { [category: string]: Package[] } = {
to: 'https://github.com/wildnothing/asset-data-decoder',
title: 'AssetData decoder library in Java',
shouldOpenInNewTab: true,
- type: LinkType.External,
},
},
],
@@ -560,7 +541,6 @@ export class Home extends React.Component<HomeProps, HomeState> {
<Link
to={pkg.link.to}
fontColor={colors.lightLinkBlue}
- type={pkg.link.type}
shouldOpenInNewTab={!!pkg.link.shouldOpenInNewTab}
>
<Text Tag="div" fontColor={colors.lightLinkBlue} fontWeight="bold">
@@ -584,7 +564,6 @@ export class Home extends React.Component<HomeProps, HomeState> {
<Link
to={pkg.link.to}
fontColor={colors.lightLinkBlue}
- type={pkg.link.type}
shouldOpenInNewTab={!!pkg.link.shouldOpenInNewTab}
>
<Container className="flex">
diff --git a/packages/website/ts/pages/wiki/wiki.tsx b/packages/website/ts/pages/wiki/wiki.tsx
index 230fff410..70f54aceb 100644
--- a/packages/website/ts/pages/wiki/wiki.tsx
+++ b/packages/website/ts/pages/wiki/wiki.tsx
@@ -3,7 +3,6 @@ import {
colors,
constants as sharedConstants,
HeaderSizes,
- LinkType,
MarkdownSection,
NestedSidebarMenu,
Styles,
@@ -234,7 +233,6 @@ export class Wiki extends React.Component<WikiProps, WikiState> {
return {
to: sharedUtils.getIdFromName(article.title),
title: article.title,
- type: LinkType.ReactScroll,
};
});
sectionNameToLinks[sectionName] = articleLinks;