aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLibravatar Renard 2019-09-22 19:27:31 -0300
committerLibravatar Renard 2019-09-22 19:27:31 -0300
commit7fc39e132947b162e3f803ba46cc15cbf3f1d4db (patch)
treef75bd735aa9827cecb898f169a80254ae8756cfd /src
parentebb25e4d544449c06cfd08064a28df77b923fc19 (diff)
downloadbai-client-7fc39e132947b162e3f803ba46cc15cbf3f1d4db.tar.gz
bai-client-7fc39e132947b162e3f803ba46cc15cbf3f1d4db.tar.xz
bai-client-7fc39e132947b162e3f803ba46cc15cbf3f1d4db.zip
nightMode setting
Diffstat (limited to 'src')
-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() {