on master help sign in
Merge pull request #150 from urbit/fix/walletgen-styles

import walletgen styles for walletgen appview

commit181f4f7de797de8d263398ea897021eacab59cfa authorMatt Condon <mattgcondon@gmail.com> dateMon 10 Jun 2019, 14:51 (7 years ago) parent16e4595045685d
3 files changed+18−29
src/Root.js+16−21 src/walletgen/Walletgen.js+2 src/walletgen/index.js−8
src/Root.js+16−21
@@ -1,7 +1,7 @@
11import 'babel-polyfill' // required for @ledgerhq/hw-transport-u2f
22
33import React from 'react'
4−import _ from 'lodash'
4+import { get } from 'lodash'
55
66import Bridge from './bridge/Bridge'
77import Walletgen from './walletgen/Walletgen'
@@ -36,11 +36,11 @@ class Root extends React.Component {
3636 */
3737
3838 isWalletgenStyle(styleSheet) {
39− return _.get(styleSheet, 'cssRules[0].selectorText', null) === "walletgen"
39+ return get(styleSheet, 'cssRules[0].selectorText', null) === "walletgen"
4040 }
4141
4242 isBridgeStyle(styleSheet) {
43− return _.get(styleSheet, 'cssRules[0].selectorText', null) === "bridge"
43+ return get(styleSheet, 'cssRules[0].selectorText', null) === "bridge"
4444 }
4545
4646 disableStylesheets(appView) {
@@ -70,25 +70,20 @@ class Root extends React.Component {
7070 }
7171
7272 render() {
73− let appComponent = null;
74−
75− if (this.state.appView === "walletgen") {
76− appComponent = <Walletgen
77− appView={this.state.appView}
78− setView={this.setView} />
79− }
80−
81− if (this.state.appView === "bridge") {
82− appComponent = <Bridge
83− appView={this.state.appView}
84− setView={this.setView} />
73+ const { appView } = this.state;
74+
75+ switch (appView) {
76+ case "walletgen":
77+ return <Walletgen
78+ appView={appView}
79+ setView={this.setView} />
80+ case "bridge":
81+ return <Bridge
82+ appView={appView}
83+ setView={this.setView} />
84+ default:
85+ throw new Error(`Unknown appView ${appView}`)
8586 }
86−
87− return (
88− <React.Fragment>
89− {appComponent}
90− </React.Fragment>
91− )
9287 }
9388}
9489
src/walletgen/Walletgen.js+2
@@ -17,6 +17,8 @@ import Custody from './views/Custody'
1717import Download from './views/Download'
1818import Done from './views/Done'
1919
20+import './style/index.css';
21+
2022const checkNetwork = () => navigator.onLine
2123 ? NETWORK_STATES.ONLINE
2224 : NETWORK_STATES.OFFLINE
src/walletgen/index.jsdeleted−8
@@ -1,8 +0,0 @@
1−import "babel-polyfill";
2−import React from 'react';
3−import ReactDOM from 'react-dom';
4−// import styles from './styles/index.css';
5−
6−import App from './App'
7−
8−ReactDOM.render(<App />, document.getElementById('root-walletgen'))