diff options
Diffstat (limited to 'packages/website/ts/pages')
4 files changed, 15 insertions, 2 deletions
diff --git a/packages/website/ts/pages/documentation/docs_info.ts b/packages/website/ts/pages/documentation/docs_info.ts index f607c2185..fd8e9df74 100644 --- a/packages/website/ts/pages/documentation/docs_info.ts +++ b/packages/website/ts/pages/documentation/docs_info.ts @@ -13,6 +13,7 @@ import { export class DocsInfo { public packageName: string; public packageUrl: string; + public subPackageName?: string; public websitePath: string; public docsJsonRoot: string; public menu: DocsMenu; @@ -22,6 +23,7 @@ export class DocsInfo { constructor(config: DocsInfoConfig) { this.packageName = config.packageName; this.packageUrl = config.packageUrl; + this.subPackageName = config.subPackageName; this.websitePath = config.websitePath; this.docsJsonRoot = config.docsJsonRoot; this.sections = config.sections; diff --git a/packages/website/ts/pages/documentation/documentation.tsx b/packages/website/ts/pages/documentation/documentation.tsx index 288a8f79c..b56441bfe 100644 --- a/packages/website/ts/pages/documentation/documentation.tsx +++ b/packages/website/ts/pages/documentation/documentation.tsx @@ -335,6 +335,7 @@ export class Documentation extends version={this.props.docsVersion} source={property.source} baseUrl={this.props.docsInfo.packageUrl} + subPackageName={this.props.docsInfo.subPackageName} /> } {property.comment && diff --git a/packages/website/ts/pages/documentation/method_block.tsx b/packages/website/ts/pages/documentation/method_block.tsx index 3f4eb7164..44e549211 100644 --- a/packages/website/ts/pages/documentation/method_block.tsx +++ b/packages/website/ts/pages/documentation/method_block.tsx @@ -95,6 +95,7 @@ export class MethodBlock extends React.Component<MethodBlockProps, MethodBlockSt version={this.props.libraryVersion} source={(method as TypescriptMethod).source} baseUrl={this.props.docsInfo.packageUrl} + subPackageName={this.props.docsInfo.subPackageName} /> } {method.comment && diff --git a/packages/website/ts/pages/documentation/source_link.tsx b/packages/website/ts/pages/documentation/source_link.tsx index 408dcabc7..74fc6d4d5 100644 --- a/packages/website/ts/pages/documentation/source_link.tsx +++ b/packages/website/ts/pages/documentation/source_link.tsx @@ -1,3 +1,4 @@ +import * as _ from 'lodash'; import {colors} from 'material-ui/styles'; import * as React from 'react'; import {Source} from 'ts/types'; @@ -7,14 +8,22 @@ interface SourceLinkProps { source: Source; baseUrl: string; version: string; + subPackageName: string; } -const SUB_PKG = '0x.js'; +const packagesWithNamespace = [ + 'connect', +]; export function SourceLink(props: SourceLinkProps) { const src = props.source; const url = props.baseUrl; - const sourceCodeUrl = `${url}/blob/${SUB_PKG}%40${props.version}/packages/${SUB_PKG}/${src.fileName}#L${src.line}`; + const pkg = props.subPackageName; + let tagPrefix = pkg; + if (_.includes(packagesWithNamespace, pkg)) { + tagPrefix = `@0xproject/${pkg}`; + } + const sourceCodeUrl = `${url}/blob/${tagPrefix}%40${props.version}/packages/${pkg}/${src.fileName}#L${src.line}`; return ( <div className="pt2" style={{fontSize: 14}}> <a |