From d9f09b5e1e7ecc8dc56ac7184cfc0152b3c2ff32 Mon Sep 17 00:00:00 2001
From: Fabio Berger <me@fabioberger.com>
Date: Fri, 3 Aug 2018 19:45:09 +0200
Subject: Make rendering of individually exported functions lighter-weight

---
 packages/react-docs/src/components/documentation.tsx | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

(limited to 'packages/react-docs/src/components/documentation.tsx')

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>
                 )}
-- 
cgit v1.2.3

