Remove type prop and instead infer it from the value of to

This commit is contained in:
Fabio Berger
2018-10-05 14:55:28 +01:00
parent 5f2cd33da0
commit fa6bd34899
16 changed files with 69 additions and 95 deletions

View File

@@ -2,6 +2,7 @@ import {
colors, colors,
constants as sharedConstants, constants as sharedConstants,
EtherscanLinkSuffixes, EtherscanLinkSuffixes,
Link,
MarkdownSection, MarkdownSection,
NestedSidebarMenu, NestedSidebarMenu,
Networks, Networks,
@@ -319,9 +320,9 @@ export class Documentation extends React.Component<DocumentationProps, Documenta
<div className="pt2" key={`external-export-${exportName}`}> <div className="pt2" key={`external-export-${exportName}`}>
<code className={`hljs ${constants.TYPE_TO_SYNTAX[this.props.docsInfo.type]}`}> <code className={`hljs ${constants.TYPE_TO_SYNTAX[this.props.docsInfo.type]}`}>
{`import { `} {`import { `}
<a href={link} target="_blank" style={{ color: colors.lightBlueA700, textDecoration: 'none' }}> <Link to={link} shouldOpenInNewTab={true} fontColor={colors.lightBlueA700}>
{exportName} {exportName}
</a> </Link>
{` } from '${this.props.docsInfo.packageName}'`} {` } from '${this.props.docsInfo.packageName}'`}
</code> </code>
</div> </div>
@@ -350,14 +351,16 @@ export class Documentation extends React.Component<DocumentationProps, Documenta
EtherscanLinkSuffixes.Address, EtherscanLinkSuffixes.Address,
); );
return ( return (
<a <div style={{ marginTop: 8 }}>
key={`badge-${networkName}-${sectionName}`} <Link
href={linkIfExists} key={`badge-${networkName}-${sectionName}`}
target="_blank" to={linkIfExists}
style={{ color: colors.white, textDecoration: 'none', marginTop: 8 }} shouldOpenInNewTab={true}
> fontColor={colors.white}
<Badge title={networkName} backgroundColor={networkNameToColor[networkName]} /> >
</a> <Badge title={networkName} backgroundColor={networkNameToColor[networkName]} />
</Link>
</div>
); );
}, },
); );

View File

@@ -1,4 +1,4 @@
import { colors, constants as sharedConstants, utils as sharedUtils } from '@0xproject/react-shared'; import { colors, constants as sharedConstants, Link, utils as sharedUtils } from '@0xproject/react-shared';
import { Type as TypeDef, TypeDefinitionByName, TypeDocTypes } from '@0xproject/types'; import { Type as TypeDef, TypeDefinitionByName, TypeDocTypes } from '@0xproject/types';
import { errorUtils } from '@0xproject/utils'; import { errorUtils } from '@0xproject/utils';
import * as _ from 'lodash'; import * as _ from 'lodash';
@@ -205,14 +205,9 @@ export const Type: React.SFC<TypeProps> = (props: TypeProps): any => {
const typeNameUrlIfExists = !_.isUndefined(props.type.externalLink) ? props.type.externalLink : undefined; const typeNameUrlIfExists = !_.isUndefined(props.type.externalLink) ? props.type.externalLink : undefined;
if (!_.isUndefined(typeNameUrlIfExists)) { if (!_.isUndefined(typeNameUrlIfExists)) {
typeName = ( typeName = (
<a <Link to={typeNameUrlIfExists} shouldOpenInNewTab={true} fontColor={colors.lightBlueA700}>
href={typeNameUrlIfExists}
target="_blank"
className="text-decoration-none"
style={{ color: colors.lightBlueA700 }}
>
{typeName} {typeName}
</a> </Link>
); );
} else if ( } else if (
(isReference || isArray) && (isReference || isArray) &&

View File

@@ -1,4 +1,4 @@
import { ALink, LinkType, utils as sharedUtils } from '@0xproject/react-shared'; import { ALink, utils as sharedUtils } from '@0xproject/react-shared';
import { DocAgnosticFormat, ObjectMap, TypeDefinitionByName } from '@0xproject/types'; import { DocAgnosticFormat, ObjectMap, TypeDefinitionByName } from '@0xproject/types';
import * as _ from 'lodash'; import * as _ from 'lodash';
@@ -62,7 +62,6 @@ export class DocsInfo {
return { return {
to: `${sectionName}-${typeName}`, to: `${sectionName}-${typeName}`,
title: typeName, title: typeName,
type: LinkType.ReactScroll,
}; };
}); });
subsectionNameToLinks[sectionName] = typeLinks; subsectionNameToLinks[sectionName] = typeLinks;
@@ -86,7 +85,6 @@ export class DocsInfo {
return { return {
to: `${sectionName}-${name}`, to: `${sectionName}-${name}`,
title: name, title: name,
type: LinkType.ReactScroll,
}; };
}); });
@@ -114,7 +112,6 @@ export class DocsInfo {
links.push({ links.push({
title: linkTitle, title: linkTitle,
to, to,
type: LinkType.ReactScroll,
}); });
}); });
}); });

View File

@@ -2,13 +2,13 @@ import * as _ from 'lodash';
import * as React from 'react'; import * as React from 'react';
import { Link as ReactRounterLink } from 'react-router-dom'; import { Link as ReactRounterLink } from 'react-router-dom';
import { Link as ScrollLink } from 'react-scroll'; import { Link as ScrollLink } from 'react-scroll';
import * as validUrl from 'valid-url';
import { LinkType } from '../types'; import { LinkType } from '../types';
import { constants } from '../utils/constants'; import { constants } from '../utils/constants';
interface LinkProps { interface LinkProps {
to: string; to: string;
type?: LinkType;
shouldOpenInNewTab?: boolean; shouldOpenInNewTab?: boolean;
className?: string; className?: string;
onMouseOver?: (event: React.MouseEvent<HTMLElement>) => void; onMouseOver?: (event: React.MouseEvent<HTMLElement>) => void;
@@ -28,7 +28,6 @@ export interface LinkState {}
*/ */
export class Link extends React.Component<LinkProps, LinkState> { export class Link extends React.Component<LinkProps, LinkState> {
public static defaultProps: Partial<LinkProps> = { public static defaultProps: Partial<LinkProps> = {
type: LinkType.ReactRoute,
shouldOpenInNewTab: false, shouldOpenInNewTab: false,
className: '', className: '',
onMouseOver: _.noop.bind(_), onMouseOver: _.noop.bind(_),
@@ -43,7 +42,18 @@ export class Link extends React.Component<LinkProps, LinkState> {
this._outerReactScrollSpan = null; this._outerReactScrollSpan = null;
} }
public render(): React.ReactNode { public render(): React.ReactNode {
if (this.props.type === LinkType.ReactScroll && this.props.shouldOpenInNewTab) { let type: LinkType;
const isReactRoute = _.startsWith(this.props.to, '/');
const isExternal = validUrl.isWebUri(this.props.to) || _.startsWith(this.props.to, 'mailto:');
if (isReactRoute) {
type = LinkType.ReactRoute;
} else if (isExternal) {
type = LinkType.External;
} else {
type = LinkType.ReactScroll;
}
if (type === LinkType.ReactScroll && this.props.shouldOpenInNewTab) {
throw new Error(`Cannot open LinkType.ReactScroll links in new tab. link.to: ${this.props.to}`); throw new Error(`Cannot open LinkType.ReactScroll links in new tab. link.to: ${this.props.to}`);
} }
@@ -53,9 +63,7 @@ export class Link extends React.Component<LinkProps, LinkState> {
color: this.props.fontColor, color: this.props.fontColor,
}; };
console.log('styleWithDefault', styleWithDefault); switch (type) {
switch (this.props.type) {
case LinkType.External: case LinkType.External:
return ( return (
<a <a
@@ -108,7 +116,7 @@ export class Link extends React.Component<LinkProps, LinkState> {
</span> </span>
); );
default: default:
throw new Error(`Unrecognized LinkType: ${this.props.type}`); throw new Error(`Unrecognized LinkType: ${type}`);
} }
} }
// HACK(fabio): For some reason, the react-scroll link decided to stop the propagation of click events. // HACK(fabio): For some reason, the react-scroll link decided to stop the propagation of click events.

View File

@@ -8,6 +8,7 @@ import { colors } from '../utils/colors';
import { utils } from '../utils/utils'; import { utils } from '../utils/utils';
import { AnchorTitle } from './anchor_title'; import { AnchorTitle } from './anchor_title';
import { Link } from './link';
import { MarkdownCodeBlock } from './markdown_code_block'; import { MarkdownCodeBlock } from './markdown_code_block';
import { MarkdownLinkBlock } from './markdown_link_block'; import { MarkdownLinkBlock } from './markdown_link_block';
@@ -63,13 +64,11 @@ export class MarkdownSection extends React.Component<MarkdownSectionProps, Markd
</div> </div>
<div className="col col-4 sm-hide xs-hide right-align pr3" style={{ height: 28 }}> <div className="col col-4 sm-hide xs-hide right-align pr3" style={{ height: 28 }}>
{!_.isUndefined(githubLink) && ( {!_.isUndefined(githubLink) && (
<a <div style={{ lineHeight: 2.1 }}>
href={githubLink} <Link to={githubLink} shouldOpenInNewTab={true} fontColor={colors.linkBlue}>
target="_blank" Edit on Github
style={{ color: colors.linkBlue, textDecoration: 'none', lineHeight: 2.1 }} </Link>
> </div>
Edit on Github
</a>
)} )}
</div> </div>
</div> </div>

View File

@@ -94,7 +94,7 @@ export class NestedSidebarMenu extends React.Component<NestedSidebarMenuProps, N
: link.title; : link.title;
return ( return (
<div key={`menuItem-${finalMenuItemName}`}> <div key={`menuItem-${finalMenuItemName}`}>
<Link to={link.to} type={link.type} shouldOpenInNewTab={link.shouldOpenInNewTab}> <Link to={link.to} shouldOpenInNewTab={link.shouldOpenInNewTab}>
<MenuItem <MenuItem
style={menuItemStyles} style={menuItemStyles}
innerDivStyle={menuItemInnerDivStyles} innerDivStyle={menuItemInnerDivStyles}
@@ -131,7 +131,7 @@ export class NestedSidebarMenu extends React.Component<NestedSidebarMenuProps, N
const name = `${menuItemName}-${link.title}`; const name = `${menuItemName}-${link.title}`;
return ( return (
<li key={`menuSubsectionItem-${name}`}> <li key={`menuSubsectionItem-${name}`}>
<Link to={link.to} type={link.type} shouldOpenInNewTab={link.shouldOpenInNewTab}> <Link to={link.to} shouldOpenInNewTab={link.shouldOpenInNewTab}>
<MenuItem <MenuItem
style={{ minHeight: 35 }} style={{ minHeight: 35 }}
innerDivStyle={{ innerDivStyle={{

View File

@@ -6,7 +6,7 @@ export { NestedSidebarMenu } from './components/nested_sidebar_menu';
export { SectionHeader } from './components/section_header'; export { SectionHeader } from './components/section_header';
export { Link } from './components/link'; export { Link } from './components/link';
export { HeaderSizes, Styles, EtherscanLinkSuffixes, Networks, LinkType, ALink } from './types'; export { HeaderSizes, Styles, EtherscanLinkSuffixes, Networks, ALink } from './types';
export { utils } from './utils/utils'; export { utils } from './utils/utils';
export { constants } from './utils/constants'; export { constants } from './utils/constants';

View File

@@ -30,5 +30,4 @@ export interface ALink {
title: string; title: string;
to: string; to: string;
shouldOpenInNewTab?: boolean; shouldOpenInNewTab?: boolean;
type?: LinkType;
} }

View File

@@ -62,6 +62,7 @@
"styled-components": "^3.3.0", "styled-components": "^3.3.0",
"thenby": "^1.2.3", "thenby": "^1.2.3",
"truffle-contract": "2.0.1", "truffle-contract": "2.0.1",
"valid-url": "^1.0.9",
"web3-provider-engine": "14.0.6", "web3-provider-engine": "14.0.6",
"xml-js": "^1.6.4" "xml-js": "^1.6.4"
}, },
@@ -84,6 +85,7 @@
"@types/react-scroll": "1.5.3", "@types/react-scroll": "1.5.3",
"@types/react-tap-event-plugin": "0.0.30", "@types/react-tap-event-plugin": "0.0.30",
"@types/redux": "^3.6.0", "@types/redux": "^3.6.0",
"@types/valid-url": "^1.0.2",
"@types/web3-provider-engine": "^14.0.0", "@types/web3-provider-engine": "^14.0.0",
"awesome-typescript-loader": "^5.2.1", "awesome-typescript-loader": "^5.2.1",
"copyfiles": "^2.0.0", "copyfiles": "^2.0.0",

View File

@@ -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 Dialog from 'material-ui/Dialog';
import FlatButton from 'material-ui/FlatButton'; import FlatButton from 'material-ui/FlatButton';
import * as React from 'react'; import * as React from 'react';

View File

@@ -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 _ from 'lodash';
import * as React from 'react'; import * as React from 'react';
import { Container } from 'ts/components/ui/container'; import { Container } from 'ts/components/ui/container';
@@ -46,19 +46,16 @@ const usefulLinksToLinkInfo: ALink[] = [
{ {
title: Key.Github, title: Key.Github,
to: constants.URL_GITHUB_ORG, to: constants.URL_GITHUB_ORG,
type: LinkType.External,
shouldOpenInNewTab: true, shouldOpenInNewTab: true,
}, },
{ {
title: Key.Whitepaper, title: Key.Whitepaper,
to: WebsitePaths.Whitepaper, to: WebsitePaths.Whitepaper,
type: LinkType.External,
shouldOpenInNewTab: true, shouldOpenInNewTab: true,
}, },
{ {
title: Key.Sandbox, title: Key.Sandbox,
to: constants.URL_SANDBOX, to: constants.URL_SANDBOX,
type: LinkType.External,
shouldOpenInNewTab: true, shouldOpenInNewTab: true,
}, },
]; ];
@@ -160,17 +157,16 @@ export class DevelopersDropDown extends React.Component<DevelopersDropDownProps,
const isWikiLink = _.startsWith(link.to, WebsitePaths.Wiki) && _.includes(link.to, '#'); const isWikiLink = _.startsWith(link.to, WebsitePaths.Wiki) && _.includes(link.to, '#');
const isOnWiki = this.props.location.pathname === WebsitePaths.Wiki; const isOnWiki = this.props.location.pathname === WebsitePaths.Wiki;
let to = link.to; let to = link.to;
let type = link.type; const type = link.type;
if (isWikiLink && isOnWiki) { if (isWikiLink && isOnWiki) {
to = `${link.to.split('#')[1]}`; to = `${link.to.split('#')[1]}`;
type = LinkType.ReactScroll;
} }
i++; i++;
const isLast = i === numLinks; const isLast = i === numLinks;
const linkText = this.props.translate.get(link.title as Key, Deco.Cap); const linkText = this.props.translate.get(link.title as Key, Deco.Cap);
return ( return (
<div className={`pr1 pt1 ${!isLast && 'pb1'}`} key={`dev-dropdown-link-${link.title}`}> <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}> <Text fontFamily="Roboto, Roboto Mono" fontColor={colors.lightBlueA700}>
{linkText} {linkText}
</Text> </Text>

View File

@@ -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 { ObjectMap } from '@0xproject/types';
import * as _ from 'lodash'; import * as _ from 'lodash';
import DropDownMenu from 'material-ui/DropDownMenu'; 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), title: this.props.translate.get(Key.Whitepaper, Deco.Cap),
to: WebsitePaths.Whitepaper, to: WebsitePaths.Whitepaper,
type: LinkType.External, shouldOpenInNewTab: true,
}, },
{ {
title: this.props.translate.get(Key.Wiki, Deco.Cap), title: this.props.translate.get(Key.Wiki, Deco.Cap),
@@ -68,28 +68,28 @@ export class Footer extends React.Component<FooterProps, FooterState> {
[Key.Community]: [ [Key.Community]: [
{ {
title: this.props.translate.get(Key.RocketChat, Deco.Cap), title: this.props.translate.get(Key.RocketChat, Deco.Cap),
type: LinkType.External,
to: constants.URL_ZEROEX_CHAT, to: constants.URL_ZEROEX_CHAT,
shouldOpenInNewTab: true,
}, },
{ {
title: this.props.translate.get(Key.Blog, Deco.Cap), title: this.props.translate.get(Key.Blog, Deco.Cap),
type: LinkType.External,
to: constants.URL_BLOG, to: constants.URL_BLOG,
shouldOpenInNewTab: true,
}, },
{ {
title: 'Twitter', title: 'Twitter',
type: LinkType.External,
to: constants.URL_TWITTER, to: constants.URL_TWITTER,
shouldOpenInNewTab: true,
}, },
{ {
title: 'Reddit', title: 'Reddit',
type: LinkType.External,
to: constants.URL_REDDIT, to: constants.URL_REDDIT,
shouldOpenInNewTab: true,
}, },
{ {
title: this.props.translate.get(Key.Forum, Deco.Cap), title: this.props.translate.get(Key.Forum, Deco.Cap),
type: LinkType.External,
to: constants.URL_DISCOURSE_FORUM, to: constants.URL_DISCOURSE_FORUM,
shouldOpenInNewTab: true,
}, },
], ],
[Key.Organization]: [ [Key.Organization]: [
@@ -103,8 +103,8 @@ export class Footer extends React.Component<FooterProps, FooterState> {
}, },
{ {
title: this.props.translate.get(Key.Contact, Deco.Cap), title: this.props.translate.get(Key.Contact, Deco.Cap),
type: LinkType.External,
to: 'mailto:team@0xproject.com', to: 'mailto:team@0xproject.com',
shouldOpenInNewTab: true,
}, },
], ],
}; };
@@ -182,7 +182,12 @@ export class Footer extends React.Component<FooterProps, FooterState> {
const iconIfExists = titleToIcon[link.title]; const iconIfExists = titleToIcon[link.title];
return ( return (
<div key={link.title} className="sm-center" style={{ fontSize: 13, paddingTop: 25 }}> <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> <div>
{!_.isUndefined(iconIfExists) ? ( {!_.isUndefined(iconIfExists) ? (
<div className="inline-block"> <div className="inline-block">

View File

@@ -1,13 +1,5 @@
import { DocsInfo } from '@0xproject/react-docs'; import { DocsInfo } from '@0xproject/react-docs';
import { import { ALink, colors, constants as sharedConstants, Link, NestedSidebarMenu, Styles } from '@0xproject/react-shared';
ALink,
colors,
constants as sharedConstants,
Link,
LinkType,
NestedSidebarMenu,
Styles,
} from '@0xproject/react-shared';
import { ObjectMap } from '@0xproject/types'; import { ObjectMap } from '@0xproject/types';
import * as _ from 'lodash'; import * as _ from 'lodash';
import Drawer from 'material-ui/Drawer'; import Drawer from 'material-ui/Drawer';
@@ -177,7 +169,7 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
path={constants.URL_BLOG} path={constants.URL_BLOG}
style={styles.menuItem} style={styles.menuItem}
isNightVersion={isNightVersion} isNightVersion={isNightVersion}
linkType={LinkType.External} shouldOpenInNewTab={true}
/> />
<TopBarMenuItem <TopBarMenuItem
title={this.props.translate.get(Key.About, Deco.Cap)} title={this.props.translate.get(Key.About, Deco.Cap)}
@@ -285,7 +277,7 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
</MenuItem> </MenuItem>
</Link> </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> <MenuItem className="py2">{this.props.translate.get(Key.Whitepaper, Deco.Cap)}</MenuItem>
</Link> </Link>
<Link to={WebsitePaths.About}> <Link to={WebsitePaths.About}>
@@ -294,7 +286,7 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
<Link to={WebsitePaths.Careers}> <Link to={WebsitePaths.Careers}>
<MenuItem className="py2">{this.props.translate.get(Key.Careers, Deco.Cap)}</MenuItem> <MenuItem className="py2">{this.props.translate.get(Key.Careers, Deco.Cap)}</MenuItem>
</Link> </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> <MenuItem className="py2">{this.props.translate.get(Key.Blog, Deco.Cap)}</MenuItem>
</Link> </Link>
<Link to={WebsitePaths.FAQ}> <Link to={WebsitePaths.FAQ}>

View File

@@ -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 _ from 'lodash';
import * as React from 'react'; import * as React from 'react';
@@ -12,7 +12,7 @@ interface TopBarMenuItemProps {
title: string; title: string;
path?: string; path?: string;
isPrimary?: boolean; isPrimary?: boolean;
linkType: LinkType; shouldOpenInNewTab?: boolean;
style?: React.CSSProperties; style?: React.CSSProperties;
className?: string; className?: string;
isNightVersion?: boolean; isNightVersion?: boolean;
@@ -25,6 +25,7 @@ export class TopBarMenuItem extends React.Component<TopBarMenuItemProps, TopBarM
isPrimary: false, isPrimary: false,
style: DEFAULT_STYLE, style: DEFAULT_STYLE,
className: '', className: '',
shouldOpenInNewTab: false,
isNightVersion: false, isNightVersion: false,
}; };
public render(): React.ReactNode { public render(): React.ReactNode {
@@ -37,7 +38,7 @@ export class TopBarMenuItem extends React.Component<TopBarMenuItemProps, TopBarM
); );
return ( return (
<div className={`center ${this.props.className}`} style={{ ...this.props.style, color: menuItemColor }}> <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} {itemContent}
</Link> </Link>
</div> </div>

View File

@@ -3,7 +3,6 @@ import {
colors, colors,
constants as sharedConstants, constants as sharedConstants,
Link, Link,
LinkType,
MarkdownLinkBlock, MarkdownLinkBlock,
NestedSidebarMenu, NestedSidebarMenu,
utils as sharedUtils, utils as sharedUtils,
@@ -89,7 +88,6 @@ const CATEGORY_TO_PACKAGES: { [category: string]: Package[] } = {
title: '0x starter project', title: '0x starter project',
to: 'https://github.com/0xProject/0x-starter-project', to: 'https://github.com/0xProject/0x-starter-project',
shouldOpenInNewTab: true, shouldOpenInNewTab: true,
type: LinkType.External,
}, },
}, },
{ {
@@ -144,7 +142,6 @@ const CATEGORY_TO_PACKAGES: { [category: string]: Package[] } = {
title: '@0xproject/sra-spec', title: '@0xproject/sra-spec',
to: 'https://github.com/0xProject/0x-monorepo/tree/development/packages/sra-spec', to: 'https://github.com/0xProject/0x-monorepo/tree/development/packages/sra-spec',
shouldOpenInNewTab: true, shouldOpenInNewTab: true,
type: LinkType.External,
}, },
}, },
], ],
@@ -156,7 +153,6 @@ const CATEGORY_TO_PACKAGES: { [category: string]: Package[] } = {
title: 'abi-gen', title: 'abi-gen',
to: 'https://github.com/0xProject/0x-monorepo/tree/development/packages/abi-gen', to: 'https://github.com/0xProject/0x-monorepo/tree/development/packages/abi-gen',
shouldOpenInNewTab: true, shouldOpenInNewTab: true,
type: LinkType.External,
}, },
}, },
{ {
@@ -213,7 +209,6 @@ const CATEGORY_TO_PACKAGES: { [category: string]: Package[] } = {
title: '0x Event Extractor', title: '0x Event Extractor',
to: 'https://github.com/0xTracker/0x-event-extractor', to: 'https://github.com/0xTracker/0x-event-extractor',
shouldOpenInNewTab: true, shouldOpenInNewTab: true,
type: LinkType.External,
}, },
}, },
{ {
@@ -223,7 +218,6 @@ const CATEGORY_TO_PACKAGES: { [category: string]: Package[] } = {
title: '0x Tracker Worker', title: '0x Tracker Worker',
to: 'https://github.com/0xTracker/0x-tracker-worker', to: 'https://github.com/0xTracker/0x-tracker-worker',
shouldOpenInNewTab: true, shouldOpenInNewTab: true,
type: LinkType.External,
}, },
}, },
{ {
@@ -233,7 +227,6 @@ const CATEGORY_TO_PACKAGES: { [category: string]: Package[] } = {
title: 'Aquaduct', title: 'Aquaduct',
to: 'https://www.npmjs.com/package/aqueduct', to: 'https://www.npmjs.com/package/aqueduct',
shouldOpenInNewTab: true, shouldOpenInNewTab: true,
type: LinkType.External,
}, },
}, },
{ {
@@ -243,7 +236,6 @@ const CATEGORY_TO_PACKAGES: { [category: string]: Package[] } = {
title: 'Aquaduct Server SDK', title: 'Aquaduct Server SDK',
to: 'https://github.com/ERCdEX/aqueduct-server-sdk', to: 'https://github.com/ERCdEX/aqueduct-server-sdk',
shouldOpenInNewTab: true, shouldOpenInNewTab: true,
type: LinkType.External,
}, },
}, },
{ {
@@ -252,7 +244,6 @@ const CATEGORY_TO_PACKAGES: { [category: string]: Package[] } = {
to: 'https://www.npmjs.com/package/ddex-api', to: 'https://www.npmjs.com/package/ddex-api',
title: 'DDEX Node.js SDK', title: 'DDEX Node.js SDK',
shouldOpenInNewTab: true, shouldOpenInNewTab: true,
type: LinkType.External,
}, },
}, },
{ {
@@ -261,7 +252,6 @@ const CATEGORY_TO_PACKAGES: { [category: string]: Package[] } = {
to: 'https://github.com/ERCdEX/widget', to: 'https://github.com/ERCdEX/widget',
title: 'ERCdex Widget', title: 'ERCdex Widget',
shouldOpenInNewTab: true, shouldOpenInNewTab: true,
type: LinkType.External,
}, },
}, },
{ {
@@ -270,7 +260,6 @@ const CATEGORY_TO_PACKAGES: { [category: string]: Package[] } = {
to: 'https://github.com/ERCdEX/java', to: 'https://github.com/ERCdEX/java',
title: 'ERCdex Java SDK', title: 'ERCdex Java SDK',
shouldOpenInNewTab: true, shouldOpenInNewTab: true,
type: LinkType.External,
}, },
}, },
{ {
@@ -279,7 +268,6 @@ const CATEGORY_TO_PACKAGES: { [category: string]: Package[] } = {
to: 'https://github.com/ERCdEX/python', to: 'https://github.com/ERCdEX/python',
title: 'ERCdex Python SDK', title: 'ERCdex Python SDK',
shouldOpenInNewTab: true, shouldOpenInNewTab: true,
type: LinkType.External,
}, },
}, },
{ {
@@ -289,7 +277,6 @@ const CATEGORY_TO_PACKAGES: { [category: string]: Package[] } = {
title: 'Massive', title: 'Massive',
to: 'https://github.com/NoteGio/massive', to: 'https://github.com/NoteGio/massive',
shouldOpenInNewTab: true, shouldOpenInNewTab: true,
type: LinkType.External,
}, },
}, },
{ {
@@ -298,7 +285,6 @@ const CATEGORY_TO_PACKAGES: { [category: string]: Package[] } = {
to: 'https://github.com/NoteGio/openrelay', to: 'https://github.com/NoteGio/openrelay',
title: 'OpenRelay', title: 'OpenRelay',
shouldOpenInNewTab: true, shouldOpenInNewTab: true,
type: LinkType.External,
}, },
}, },
{ {
@@ -308,7 +294,6 @@ const CATEGORY_TO_PACKAGES: { [category: string]: Package[] } = {
title: 'OpenRelay.js', title: 'OpenRelay.js',
to: 'https://github.com/NoteGio/openrelay.js', to: 'https://github.com/NoteGio/openrelay.js',
shouldOpenInNewTab: true, shouldOpenInNewTab: true,
type: LinkType.External,
}, },
}, },
{ {
@@ -318,7 +303,6 @@ const CATEGORY_TO_PACKAGES: { [category: string]: Package[] } = {
title: 'Radar SDK', title: 'Radar SDK',
to: 'https://github.com/RadarRelay/sdk', to: 'https://github.com/RadarRelay/sdk',
shouldOpenInNewTab: true, shouldOpenInNewTab: true,
type: LinkType.External,
}, },
}, },
{ {
@@ -328,7 +312,6 @@ const CATEGORY_TO_PACKAGES: { [category: string]: Package[] } = {
title: 'The Ocean Javascript SDK', title: 'The Ocean Javascript SDK',
to: 'https://github.com/TheOceanTrade/theoceanx-javascript', to: 'https://github.com/TheOceanTrade/theoceanx-javascript',
shouldOpenInNewTab: true, shouldOpenInNewTab: true,
type: LinkType.External,
}, },
}, },
{ {
@@ -337,7 +320,6 @@ const CATEGORY_TO_PACKAGES: { [category: string]: Package[] } = {
to: 'https://www.npmjs.com/package/tokenlon-sdk', to: 'https://www.npmjs.com/package/tokenlon-sdk',
title: 'Tokenlon Javascript SDK', title: 'Tokenlon Javascript SDK',
shouldOpenInNewTab: true, shouldOpenInNewTab: true,
type: LinkType.External,
}, },
}, },
{ {
@@ -346,7 +328,6 @@ const CATEGORY_TO_PACKAGES: { [category: string]: Package[] } = {
to: 'https://github.com/wildnothing/asset-data-decoder', to: 'https://github.com/wildnothing/asset-data-decoder',
title: 'AssetData decoder library in Java', title: 'AssetData decoder library in Java',
shouldOpenInNewTab: true, shouldOpenInNewTab: true,
type: LinkType.External,
}, },
}, },
], ],
@@ -560,7 +541,6 @@ export class Home extends React.Component<HomeProps, HomeState> {
<Link <Link
to={pkg.link.to} to={pkg.link.to}
fontColor={colors.lightLinkBlue} fontColor={colors.lightLinkBlue}
type={pkg.link.type}
shouldOpenInNewTab={!!pkg.link.shouldOpenInNewTab} shouldOpenInNewTab={!!pkg.link.shouldOpenInNewTab}
> >
<Text Tag="div" fontColor={colors.lightLinkBlue} fontWeight="bold"> <Text Tag="div" fontColor={colors.lightLinkBlue} fontWeight="bold">
@@ -584,7 +564,6 @@ export class Home extends React.Component<HomeProps, HomeState> {
<Link <Link
to={pkg.link.to} to={pkg.link.to}
fontColor={colors.lightLinkBlue} fontColor={colors.lightLinkBlue}
type={pkg.link.type}
shouldOpenInNewTab={!!pkg.link.shouldOpenInNewTab} shouldOpenInNewTab={!!pkg.link.shouldOpenInNewTab}
> >
<Container className="flex"> <Container className="flex">

View File

@@ -3,7 +3,6 @@ import {
colors, colors,
constants as sharedConstants, constants as sharedConstants,
HeaderSizes, HeaderSizes,
LinkType,
MarkdownSection, MarkdownSection,
NestedSidebarMenu, NestedSidebarMenu,
Styles, Styles,
@@ -234,7 +233,6 @@ export class Wiki extends React.Component<WikiProps, WikiState> {
return { return {
to: sharedUtils.getIdFromName(article.title), to: sharedUtils.getIdFromName(article.title),
title: article.title, title: article.title,
type: LinkType.ReactScroll,
}; };
}); });
sectionNameToLinks[sectionName] = articleLinks; sectionNameToLinks[sectionName] = articleLinks;