From acef1130cb0ab180be48ffb5ae0d805c881db795 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Thu, 28 Feb 2019 14:04:55 -0300 Subject: [PATCH] cleanup, keep render function short --- src/routes/Faucet.tsx | 78 +++++++++++++++++++++++++------------------ 1 file changed, 46 insertions(+), 32 deletions(-) diff --git a/src/routes/Faucet.tsx b/src/routes/Faucet.tsx index 2909dce..51f9404 100644 --- a/src/routes/Faucet.tsx +++ b/src/routes/Faucet.tsx @@ -13,7 +13,7 @@ interface FaucetState { eth?: string } -class Faucet extends PureComponent<{}, FaucetState> { +export default class Faucet extends PureComponent<{}, FaucetState> { public state = { isLoading: false, success: undefined, @@ -37,6 +37,50 @@ class Faucet extends PureComponent<{}, FaucetState> { } } + private RequestMarkup = () => ( + + {states => ( + + )} + + ) + + private ActionMarkup = () => ( +
+ {this.state.isLoading ? ( + + ) : this.state.error ? ( +
+ {this.state.error}{' '} + +
+ ) : this.state.success ? ( +
{this.state.success}
+ ) : ( + + )} + +

+ You can only request Ether once every 24 hours for your address. +

+
+ ) + + private reset = () => { + this.setState({ + error: undefined, + success: undefined, + isLoading: false + }) + } + public render() { return ( { > -
- - {states => - this.state.isLoading ? ( - - ) : this.state.error ? ( - this.state.error - ) : this.state.success ? ( -
- {this.state.success} -
- ) : ( - - ) - } -
- -

- You can only request Ether once every 24 hours for your - address. -

-
+
) } } - -export default Faucet