Remove type prop and instead infer it from the value of to
This commit is contained in:
@@ -2,6 +2,7 @@ import {
|
||||
colors,
|
||||
constants as sharedConstants,
|
||||
EtherscanLinkSuffixes,
|
||||
Link,
|
||||
MarkdownSection,
|
||||
NestedSidebarMenu,
|
||||
Networks,
|
||||
@@ -319,9 +320,9 @@ export class Documentation extends React.Component<DocumentationProps, Documenta
|
||||
<div className="pt2" key={`external-export-${exportName}`}>
|
||||
<code className={`hljs ${constants.TYPE_TO_SYNTAX[this.props.docsInfo.type]}`}>
|
||||
{`import { `}
|
||||
<a href={link} target="_blank" style={{ color: colors.lightBlueA700, textDecoration: 'none' }}>
|
||||
<Link to={link} shouldOpenInNewTab={true} fontColor={colors.lightBlueA700}>
|
||||
{exportName}
|
||||
</a>
|
||||
</Link>
|
||||
{` } from '${this.props.docsInfo.packageName}'`}
|
||||
</code>
|
||||
</div>
|
||||
@@ -350,14 +351,16 @@ export class Documentation extends React.Component<DocumentationProps, Documenta
|
||||
EtherscanLinkSuffixes.Address,
|
||||
);
|
||||
return (
|
||||
<a
|
||||
key={`badge-${networkName}-${sectionName}`}
|
||||
href={linkIfExists}
|
||||
target="_blank"
|
||||
style={{ color: colors.white, textDecoration: 'none', marginTop: 8 }}
|
||||
>
|
||||
<Badge title={networkName} backgroundColor={networkNameToColor[networkName]} />
|
||||
</a>
|
||||
<div style={{ marginTop: 8 }}>
|
||||
<Link
|
||||
key={`badge-${networkName}-${sectionName}`}
|
||||
to={linkIfExists}
|
||||
shouldOpenInNewTab={true}
|
||||
fontColor={colors.white}
|
||||
>
|
||||
<Badge title={networkName} backgroundColor={networkNameToColor[networkName]} />
|
||||
</Link>
|
||||
</div>
|
||||
);
|
||||
},
|
||||
);
|
||||
|
@@ -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 { errorUtils } from '@0xproject/utils';
|
||||
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;
|
||||
if (!_.isUndefined(typeNameUrlIfExists)) {
|
||||
typeName = (
|
||||
<a
|
||||
href={typeNameUrlIfExists}
|
||||
target="_blank"
|
||||
className="text-decoration-none"
|
||||
style={{ color: colors.lightBlueA700 }}
|
||||
>
|
||||
<Link to={typeNameUrlIfExists} shouldOpenInNewTab={true} fontColor={colors.lightBlueA700}>
|
||||
{typeName}
|
||||
</a>
|
||||
</Link>
|
||||
);
|
||||
} else if (
|
||||
(isReference || isArray) &&
|
||||
|
@@ -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 * as _ from 'lodash';
|
||||
|
||||
@@ -62,7 +62,6 @@ export class DocsInfo {
|
||||
return {
|
||||
to: `${sectionName}-${typeName}`,
|
||||
title: typeName,
|
||||
type: LinkType.ReactScroll,
|
||||
};
|
||||
});
|
||||
subsectionNameToLinks[sectionName] = typeLinks;
|
||||
@@ -86,7 +85,6 @@ export class DocsInfo {
|
||||
return {
|
||||
to: `${sectionName}-${name}`,
|
||||
title: name,
|
||||
type: LinkType.ReactScroll,
|
||||
};
|
||||
});
|
||||
|
||||
@@ -114,7 +112,6 @@ export class DocsInfo {
|
||||
links.push({
|
||||
title: linkTitle,
|
||||
to,
|
||||
type: LinkType.ReactScroll,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user