on master help sign in
- Disable/enable styles properly, albeit hacky solution
083d7c6Chris Johnson
src/Bridge.js−2
@@ -83,8 +83,6 @@ class Bridge extends React.Component {
83 this.popRoute();
83 this.popRoute();
84 }
84 }
85
85
86− import('./style/index.css')
87−
88 // NB (jtobin):
86 // NB (jtobin):
89 //
87 //
90 // If running in development, the following can be tweaked to get you set
88 // If running in development, the following can be tweaked to get you set
src/Root.js+23
@@ -6,6 +6,9 @@ import ReactDOM from 'react-dom'
6import Bridge from './Bridge'
6import Bridge from './Bridge'
7import Walletgen from './walletgen/Walletgen'
7import Walletgen from './walletgen/Walletgen'
8
8
9+import './style/index.css'
10+import './walletgen/styles/index.css'
11+
9class Root extends React.Component {
12class Root extends React.Component {
10 constructor(props) {
13 constructor(props) {
11 super(props)
14 super(props)
@@ -17,7 +20,27 @@ class Root extends React.Component {
17 this.setView = this.setView.bind(this)
20 this.setView = this.setView.bind(this)
18 }
21 }
19
22
23+ componentDidMount() {
24+ let styles = document.getElementsByTagName('style')
25+
26+ for (var i = 0; i < styles.length; i++) {
27+ if (i < 7) styles[i].classList.add('css-bridge');
28+ if (i >= 7) {
29+ styles[i].classList.add('css-walletgen');
30+ styles[i].disabled = true;
31+ }
32+ }
33+ }
34+
20 setView(appView) {
35 setView(appView) {
36+ if (appView === "bridge") {
37+ document.querySelectorAll('.css-walletgen').forEach(s => s.disabled = true)
38+ document.querySelectorAll('.css-bridge').forEach(s => s.disabled = false)
39+ } else if (appView === "walletgen") {
40+ document.querySelectorAll('.css-walletgen').forEach(s => s.disabled = false)
41+ document.querySelectorAll('.css-bridge').forEach(s => s.disabled = true)
42+ }
43+
21 this.setState({
44 this.setState({
22 appView
45 appView
23 })
46 })
src/walletgen/Walletgen.js−2
@@ -89,8 +89,6 @@ class Walletgen extends React.Component {
89 componentDidMount = () => {
89 componentDidMount = () => {
90 window.addEventListener('online', () => this.setState({'network': NETWORK_STATES.ONLINE}));
90 window.addEventListener('online', () => this.setState({'network': NETWORK_STATES.ONLINE}));
91 window.addEventListener('offline', () => this.setState({'network': NETWORK_STATES.OFFLINE}));
91 window.addEventListener('offline', () => this.setState({'network': NETWORK_STATES.OFFLINE}));
92−
93− import('./styles/index.css')
94 };
92 };
95
93
96
94