aboutsummaryrefslogtreecommitdiffstats
path: root/packages/react-docs/src/components/signature.tsx
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-08-15 08:24:48 +0800
committerFabio Berger <me@fabioberger.com>2018-08-15 08:24:48 +0800
commitcb5d8d75bf03910d1e763eb34907ada296ed3062 (patch)
tree2e9533026ac91799326419445f04b9d424347c66 /packages/react-docs/src/components/signature.tsx
parent267078ed6cea11aa8accc2336898694b77e8f169 (diff)
downloaddexon-sol-tools-cb5d8d75bf03910d1e763eb34907ada296ed3062.tar.gz
dexon-sol-tools-cb5d8d75bf03910d1e763eb34907ada296ed3062.tar.zst
dexon-sol-tools-cb5d8d75bf03910d1e763eb34907ada296ed3062.zip
Link class reference types exported in same package to their declaration
Diffstat (limited to 'packages/react-docs/src/components/signature.tsx')
-rw-r--r--packages/react-docs/src/components/signature.tsx22
1 files changed, 20 insertions, 2 deletions
diff --git a/packages/react-docs/src/components/signature.tsx b/packages/react-docs/src/components/signature.tsx
index d9567c9f6..bf9c8be24 100644
--- a/packages/react-docs/src/components/signature.tsx
+++ b/packages/react-docs/src/components/signature.tsx
@@ -17,6 +17,7 @@ export interface SignatureProps {
typeParameter?: TypeParameter;
callPath?: string;
docsInfo: DocsInfo;
+ isInPopover: boolean;
}
const defaultProps = {
@@ -27,7 +28,13 @@ const defaultProps = {
export const Signature: React.SFC<SignatureProps> = (props: SignatureProps) => {
const sectionName = props.sectionName;
- const parameters = renderParameters(props.parameters, props.docsInfo, sectionName, props.typeDefinitionByName);
+ const parameters = renderParameters(
+ props.parameters,
+ props.docsInfo,
+ sectionName,
+ props.isInPopover,
+ props.typeDefinitionByName,
+ );
const paramStringArray: any[] = [];
// HACK: For now we don't put params on newlines if there are less then 2 of them.
// Ideally we would check the character length of the resulting method signature and
@@ -57,7 +64,13 @@ export const Signature: React.SFC<SignatureProps> = (props: SignatureProps) => {
const methodName = props.shouldHideMethodName ? '' : props.name;
const typeParameterIfExists = _.isUndefined(props.typeParameter)
? undefined
- : renderTypeParameter(props.typeParameter, props.docsInfo, sectionName, props.typeDefinitionByName);
+ : renderTypeParameter(
+ props.typeParameter,
+ props.docsInfo,
+ sectionName,
+ props.isInPopover,
+ props.typeDefinitionByName,
+ );
return (
<span style={{ fontSize: 15 }}>
{props.callPath}
@@ -72,6 +85,7 @@ export const Signature: React.SFC<SignatureProps> = (props: SignatureProps) => {
sectionName={sectionName}
typeDefinitionByName={props.typeDefinitionByName}
docsInfo={props.docsInfo}
+ isInPopover={props.isInPopover}
/>
</span>
)}
@@ -85,6 +99,7 @@ function renderParameters(
parameters: Parameter[],
docsInfo: DocsInfo,
sectionName: string,
+ isInPopover: boolean,
typeDefinitionByName?: TypeDefinitionByName,
): React.ReactNode[] {
const params = _.map(parameters, (p: Parameter) => {
@@ -96,6 +111,7 @@ function renderParameters(
sectionName={sectionName}
typeDefinitionByName={typeDefinitionByName}
docsInfo={docsInfo}
+ isInPopover={isInPopover}
/>
);
return (
@@ -113,6 +129,7 @@ function renderTypeParameter(
typeParameter: TypeParameter,
docsInfo: DocsInfo,
sectionName: string,
+ isInPopover: boolean,
typeDefinitionByName?: TypeDefinitionByName,
): React.ReactNode {
const typeParam = (
@@ -123,6 +140,7 @@ function renderTypeParameter(
sectionName={sectionName}
typeDefinitionByName={typeDefinitionByName}
docsInfo={docsInfo}
+ isInPopover={isInPopover}
/>
{`>`}
</span>