aboutsummaryrefslogtreecommitdiff
path: root/src/App.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/App.js')
-rw-r--r--src/App.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/App.js b/src/App.js
index 9ea8330..864eaa2 100644
--- a/src/App.js
+++ b/src/App.js
@@ -23,7 +23,7 @@ class App extends Component {
this.state = {
boardList: [],
isLoaded: false,
- nightMode: true
+ nightMode: false
};
this.toggleTheme = this.toggleTheme.bind(this);
}
@@ -36,6 +36,13 @@ class App extends Component {
.then(resource => {
this.setState({ boardList: resource["boards"], isLoaded: true });
});
+
+ let _nightMode = localStorage.getItem("nightMode");
+ if (_nightMode === null) {
+ localStorage.setItem("nightMode", false);
+ } else {
+ this.setState({ nightMode: JSON.parse(_nightMode) });
+ }
}
componentDidUpdate() {
@@ -47,7 +54,9 @@ class App extends Component {
}
toggleTheme() {
- this.setState({ nightMode: !this.state.nightMode });
+ this.setState({ nightMode: !this.state.nightMode }, () => {
+ localStorage.setItem("nightMode", this.state.nightMode);
+ });
}
render() {