From 31fe5d901397c6b771539daf2231b1c58128dcdb Mon Sep 17 00:00:00 2001 From: Sean Casey Date: Sat, 24 Aug 2019 19:35:25 -0400 Subject: [PATCH] added LoadingContainer to ui-tests for react context api --- ui-tests/react-context/src/App.js | 13 +- ui-tests/react-context/src/MyComponent.js | 544 +++++++++++----------- 2 files changed, 280 insertions(+), 277 deletions(-) diff --git a/ui-tests/react-context/src/App.js b/ui-tests/react-context/src/App.js index 6a3282b7..9a6ac6a1 100644 --- a/ui-tests/react-context/src/App.js +++ b/ui-tests/react-context/src/App.js @@ -1,6 +1,7 @@ import React, { Component } from "react"; import { Drizzle } from '@drizzle/store'; import { DrizzleContext } from "@drizzle/react-plugin"; +import { newContextComponents } from "@drizzle/react-components"; import "./App.css"; @@ -8,12 +9,22 @@ import drizzleOptions from "./drizzleOptions"; import MyComponent from "./MyComponent"; const drizzle = new Drizzle(drizzleOptions); +const { LoadingContainer } = newContextComponents; class App extends Component { render() { return ( - + + {drizzleContext => + + + + } + ); } diff --git a/ui-tests/react-context/src/MyComponent.js b/ui-tests/react-context/src/MyComponent.js index d1e08c1e..78c79a55 100644 --- a/ui-tests/react-context/src/MyComponent.js +++ b/ui-tests/react-context/src/MyComponent.js @@ -1,6 +1,5 @@ import React from "react"; import { newContextComponents } from "@drizzle/react-components"; -import { DrizzleContext } from "@drizzle/react-plugin"; import logo from "./logo.png"; const { AccountData, ContractData, ContractForm } = newContextComponents; @@ -11,288 +10,281 @@ const myRender = data => ( ); -export default () => ( - - {drizzleContext => { - const { drizzle, drizzleState, initialized } = drizzleContext; - if (!initialized) { - return "Loading..."; - } +export default (props) => { + const { drizzle, drizzleState } = props; - const { accounts } = drizzleState; - return ( -
-
- drizzle-logo -

Drizzle Examples: Context API

-

- Examples of how to get started with Drizzle in various situations. -

-
+ const { accounts } = drizzleState; + return ( +
+
+ drizzle-logo +

Drizzle Examples: Context API

+

+ Examples of how to get started with Drizzle in various situations. +

+
-
-

Active Account

- +
+

Active Account

+ -

Active Account with Custom Rendered Component

- ( -
-
My Address: {address}
-
My Ether: {balance} {units}
-
- )} - /> -
+

Active Account with Custom Rendered Component

+ ( +
+
My Address: {address}
+
My Ether: {balance} {units}
+
+ )} + /> +
-
-

SimpleStorage

-

- This shows a simple ContractData component with no arguments, - along with a form to set its value. -

-

- Stored Value: - -

- -

- Stored Boolean Value: - -

- +
+

SimpleStorage

+

+ This shows a simple ContractData component with no arguments, + along with a form to set its value. +

+

+ Stored Value: + +

+ +

+ Stored Boolean Value: + +

+ -

SimpleStorage with Custom Rendering

-

- This is the same contract as above, but here we customize the ContractForm's rendered component's style. -

- ( -
- {inputs.map((input, index) => ( - - ))} - -
+

SimpleStorage with Custom Rendering

+

+ This is the same contract as above, but here we customize the ContractForm's rendered component's style. +

+ ( +
+ {inputs.map((input, index) => ( + + ))} + +
- )} - /> -
+ )} + /> +
-
-

TutorialToken

-

- Here we have a form with custom, friendly labels. Also note the - token symbol will not display a loading indicator. We've - suppressed it with the hideIndicator prop because we - know this variable is constant. -

-

- Total Supply: - {" "} - -

-

- My Balance: - -

-

Send Tokens

- -
+
+

TutorialToken

+

+ Here we have a form with custom, friendly labels. Also note the + token symbol will not display a loading indicator. We've + suppressed it with the hideIndicator prop because we + know this variable is constant. +

+

+ Total Supply: + {" "} + +

+

+ My Balance: + +

+

Send Tokens

+ +
-
-

ComplexStorage

-

- This contract shows data types with additional considerations. - Note in the code the strings below are converted from bytes to - UTF-8 strings and the device data struct is iterated as a list. -

-

- String 1: - -

-

- String 2: - -

- Single Device Data: - - Array of UInts: - -
-
-

ComplexStorage with Custom Rendering

-

- This is the same data as above, but enhanced with a custom render - function. -

-

- String 1: - ( - <> - This is the value: {data} - - )} - /> -

-

- String 2: - -

- Single Device Data: - { - var i = 0; - const displayObjectProps = []; +
+

ComplexStorage

+

+ This contract shows data types with additional considerations. + Note in the code the strings below are converted from bytes to + UTF-8 strings and the device data struct is iterated as a list. +

+

+ String 1: + +

+

+ String 2: + +

+ Single Device Data: + + Array of UInts: + +
+
+

ComplexStorage with Custom Rendering

+

+ This is the same data as above, but enhanced with a custom render + function. +

+

+ String 1: + ( + <> + This is the value: {data} + + )} + /> +

+

+ String 2: + +

+ Single Device Data: + { + var i = 0; + const displayObjectProps = []; - Object.keys(displayData).forEach(key => { - if (i !== key) { - displayObjectProps.push( -
  • - Element {i} has key: {key} -
    - and value: {`${displayData[key]}`} -
  • - ); - } + Object.keys(displayData).forEach(key => { + if (i !== key) { + displayObjectProps.push( +
  • + Element {i} has key: {key} +
    + and value: {`${displayData[key]}`} +
  • + ); + } - i++; - }); - return
      {displayObjectProps}
    ; - }} - /> - Array of UInts: - ( -
      - {displayData.map(v => ( -
    1. - value: {v} -
    2. - ))} -
    - )} - /> -
    -
    - ); - }} - -); + i++; + }); + return
      {displayObjectProps}
    ; + }} + /> + Array of UInts: + ( +
      + {displayData.map(v => ( +
    1. + value: {v} +
    2. + ))} +
    + )} + /> +
    +
    + ); +};