aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--packages/react-docs/src/components/documentation.tsx10
-rw-r--r--packages/react-docs/src/docs_info.ts11
2 files changed, 20 insertions, 1 deletions
diff --git a/packages/react-docs/src/components/documentation.tsx b/packages/react-docs/src/components/documentation.tsx
index 4f776b237..5393652d4 100644
--- a/packages/react-docs/src/components/documentation.tsx
+++ b/packages/react-docs/src/components/documentation.tsx
@@ -211,6 +211,14 @@ export class Documentation extends React.Component<DocumentationProps, Documenta
return null;
}
+ const isExportedFunctionSection =
+ docSection.functions.length === 1 &&
+ _.isEmpty(docSection.types) &&
+ _.isEmpty(docSection.methods) &&
+ _.isEmpty(docSection.constructors) &&
+ _.isEmpty(docSection.properties) &&
+ _.isEmpty(docSection.events);
+
const sortedTypes = _.sortBy(docSection.types, 'name');
const typeDefs = _.map(sortedTypes, customType => {
return (
@@ -279,7 +287,7 @@ export class Documentation extends React.Component<DocumentationProps, Documenta
)}
{!_.isEmpty(docSection.functions) && (
<div>
- <h2 style={headerStyle}>Functions</h2>
+ {!isExportedFunctionSection && <h2 style={headerStyle}>Functions</h2>}
<div>{functionDefs}</div>
</div>
)}
diff --git a/packages/react-docs/src/docs_info.ts b/packages/react-docs/src/docs_info.ts
index 0637f3e65..36a6a7301 100644
--- a/packages/react-docs/src/docs_info.ts
+++ b/packages/react-docs/src/docs_info.ts
@@ -52,10 +52,20 @@ export class DocsInfo {
return; // no-op
}
+ const isExportedFunctionSection =
+ docSection.functions.length === 1 &&
+ _.isEmpty(docSection.types) &&
+ _.isEmpty(docSection.methods) &&
+ _.isEmpty(docSection.constructors) &&
+ _.isEmpty(docSection.properties) &&
+ _.isEmpty(docSection.events);
+
if (!_.isUndefined(this.sections.types) && sectionName === this.sections.types) {
const sortedTypesNames = _.sortBy(docSection.types, 'name');
const typeNames = _.map(sortedTypesNames, t => t.name);
menuSubsectionsBySection[sectionName] = typeNames;
+ } else if (isExportedFunctionSection) {
+ // Noop so that we don't have the method listed underneath itself.
} else {
let eventNames: string[] = [];
if (!_.isUndefined(docSection.events)) {
@@ -76,6 +86,7 @@ export class DocsInfo {
];
}
});
+ console.log('menuSubsectionsBySection', menuSubsectionsBySection);
return menuSubsectionsBySection;
}
public getTypeDefinitionsByName(docAgnosticFormat: DocAgnosticFormat): { [name: string]: TypeDefinitionByName } {