From 5347bf587fcdcfa5c08b016f3626462d67c43340 Mon Sep 17 00:00:00 2001
From: Fabio Berger <me@fabioberger.com>
Date: Thu, 27 Sep 2018 18:55:01 +0100
Subject: Render fallback functions better

---
 packages/react-docs/src/components/signature_block.tsx | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

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

diff --git a/packages/react-docs/src/components/signature_block.tsx b/packages/react-docs/src/components/signature_block.tsx
index 1ea0ea28c..fc4db10ad 100644
--- a/packages/react-docs/src/components/signature_block.tsx
+++ b/packages/react-docs/src/components/signature_block.tsx
@@ -50,6 +50,7 @@ export class SignatureBlock extends React.Component<SignatureBlockProps, Signatu
     public render(): React.ReactNode {
         const method = this.props.method;
 
+        const isFallback = (method as SolidityMethod).isFallback;
         return (
             <div
                 id={`${this.props.sectionName}-${method.name}`}
@@ -63,10 +64,11 @@ export class SignatureBlock extends React.Component<SignatureBlockProps, Signatu
                         {(method as TypescriptMethod).isStatic && this._renderChip('Static')}
                         {(method as SolidityMethod).isConstant && this._renderChip('Constant')}
                         {(method as SolidityMethod).isPayable && this._renderChip('Payable')}
+                        {isFallback && this._renderChip('Fallback', colors.lightGreenA700)}
                         <div style={{ lineHeight: 1.3 }}>
                             <AnchorTitle
                                 headerSize={HeaderSizes.H3}
-                                title={method.name}
+                                title={isFallback ? '' : method.name}
                                 id={`${this.props.sectionName}-${method.name}`}
                                 shouldShowAnchor={this.state.shouldShowAnchor}
                             />
@@ -84,6 +86,7 @@ export class SignatureBlock extends React.Component<SignatureBlockProps, Signatu
                         typeDefinitionByName={this.props.typeDefinitionByName}
                         docsInfo={this.props.docsInfo}
                         isInPopover={false}
+                        isFallback={isFallback}
                     />
                 </code>
                 {(method as TypescriptMethod).source && (
@@ -114,9 +117,9 @@ export class SignatureBlock extends React.Component<SignatureBlockProps, Signatu
             </div>
         );
     }
-    private _renderChip(text: string): React.ReactNode {
+    private _renderChip(text: string, backgroundColor: string = colors.lightBlueA700): React.ReactNode {
         return (
-            <div className="p1 mr1" style={styles.chip}>
+            <div className="p1 mr1" style={{ ...styles.chip, backgroundColor }}>
                 {text}
             </div>
         );
-- 
cgit v1.2.3


From ac878d8fdbace787c7ffbc0fe68dd404d72452e3 Mon Sep 17 00:00:00 2001
From: Fabio Berger <me@fabioberger.com>
Date: Thu, 27 Sep 2018 23:00:01 +0100
Subject: Improve keys

---
 packages/react-docs/src/components/signature_block.tsx | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

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

diff --git a/packages/react-docs/src/components/signature_block.tsx b/packages/react-docs/src/components/signature_block.tsx
index fc4db10ad..1e3de3e58 100644
--- a/packages/react-docs/src/components/signature_block.tsx
+++ b/packages/react-docs/src/components/signature_block.tsx
@@ -124,12 +124,12 @@ export class SignatureBlock extends React.Component<SignatureBlockProps, Signatu
             </div>
         );
     }
-    private _renderParameterDescriptions(parameters: Parameter[]): React.ReactNode {
-        const descriptions = _.map(parameters, parameter => {
+    private _renderParameterDescriptions(parameters: Parameter[], name: string): React.ReactNode {
+        const descriptions = _.map(parameters, (parameter: Parameter, i: number) => {
             const isOptional = parameter.isOptional;
             return (
                 <div
-                    key={`param-description-${parameter.name}`}
+                    key={`param-description-${parameter.name}-${name}-${i}`}
                     className="flex pb1 mb2"
                     style={{ borderBottom: '1px solid #f0f4f7' }}
                 >
-- 
cgit v1.2.3


From 17d4b467d468d997867843361ed623b6edb0a768 Mon Sep 17 00:00:00 2001
From: Fabio Berger <me@fabioberger.com>
Date: Thu, 27 Sep 2018 23:00:25 +0100
Subject: Only show arguments if the params are named (i.e not generated
 getters)

---
 packages/react-docs/src/components/signature_block.tsx | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

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

diff --git a/packages/react-docs/src/components/signature_block.tsx b/packages/react-docs/src/components/signature_block.tsx
index 1e3de3e58..cad72daf4 100644
--- a/packages/react-docs/src/components/signature_block.tsx
+++ b/packages/react-docs/src/components/signature_block.tsx
@@ -32,7 +32,6 @@ export interface SignatureBlockState {
 const styles: Styles = {
     chip: {
         fontSize: 13,
-        backgroundColor: colors.lightBlueA700,
         color: colors.white,
         height: 11,
         borderRadius: 14,
@@ -51,6 +50,7 @@ export class SignatureBlock extends React.Component<SignatureBlockProps, Signatu
         const method = this.props.method;
 
         const isFallback = (method as SolidityMethod).isFallback;
+        const onlyHasNamedParameters = !_.isUndefined(_.find(method.parameters, p => !_.isEmpty(p.name)));
         return (
             <div
                 id={`${this.props.sectionName}-${method.name}`}
@@ -98,12 +98,13 @@ export class SignatureBlock extends React.Component<SignatureBlockProps, Signatu
                 )}
                 {method.comment && <Comment comment={method.comment} className="py2" />}
                 {method.parameters &&
-                    !_.isEmpty(method.parameters) && (
+                    !_.isEmpty(method.parameters) &&
+                    onlyHasNamedParameters && (
                         <div>
                             <h4 className="pb1 thin" style={{ borderBottom: '1px solid #e1e8ed' }}>
                                 ARGUMENTS
                             </h4>
-                            {this._renderParameterDescriptions(method.parameters)}
+                            {this._renderParameterDescriptions(method.parameters, method.name)}
                         </div>
                     )}
                 {method.returnComment && (
-- 
cgit v1.2.3


From 092b184f4534a42d36d30d2d10b34b47255d2ee3 Mon Sep 17 00:00:00 2001
From: Fabio Berger <me@fabioberger.com>
Date: Thu, 27 Sep 2018 23:30:11 +0100
Subject: Fix linter

---
 packages/react-docs/src/components/signature_block.tsx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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

diff --git a/packages/react-docs/src/components/signature_block.tsx b/packages/react-docs/src/components/signature_block.tsx
index cad72daf4..5ec82983a 100644
--- a/packages/react-docs/src/components/signature_block.tsx
+++ b/packages/react-docs/src/components/signature_block.tsx
@@ -50,7 +50,7 @@ export class SignatureBlock extends React.Component<SignatureBlockProps, Signatu
         const method = this.props.method;
 
         const isFallback = (method as SolidityMethod).isFallback;
-        const onlyHasNamedParameters = !_.isUndefined(_.find(method.parameters, p => !_.isEmpty(p.name)));
+        const hasExclusivelyNamedParams = !_.isUndefined(_.find(method.parameters, p => !_.isEmpty(p.name)));
         return (
             <div
                 id={`${this.props.sectionName}-${method.name}`}
@@ -99,7 +99,7 @@ export class SignatureBlock extends React.Component<SignatureBlockProps, Signatu
                 {method.comment && <Comment comment={method.comment} className="py2" />}
                 {method.parameters &&
                     !_.isEmpty(method.parameters) &&
-                    onlyHasNamedParameters && (
+                    hasExclusivelyNamedParams && (
                         <div>
                             <h4 className="pb1 thin" style={{ borderBottom: '1px solid #e1e8ed' }}>
                                 ARGUMENTS
-- 
cgit v1.2.3

