From 4f42b5a2b35cf61d6042562195755699f9de177f Mon Sep 17 00:00:00 2001 From: Renard Date: Sun, 22 Sep 2019 00:28:21 -0300 Subject: Nightmode --- src/App.js | 43 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) (limited to 'src/App.js') diff --git a/src/App.js b/src/App.js index ff5e712..9ea8330 100644 --- a/src/App.js +++ b/src/App.js @@ -22,8 +22,10 @@ class App extends Component { super(); this.state = { boardList: [], - isLoaded: false + isLoaded: false, + nightMode: true }; + this.toggleTheme = this.toggleTheme.bind(this); } componentDidMount() { @@ -36,6 +38,18 @@ class App extends Component { }); } + componentDidUpdate() { + if (this.state.nightMode) { + document.body.style.backgroundColor = "#313233"; + } else { + document.body.style.backgroundColor = "#FFFFFF"; + } + } + + toggleTheme() { + this.setState({ nightMode: !this.state.nightMode }); + } + render() { if (!this.state.isLoaded) { if (!this.state.isLoaded) { @@ -87,15 +101,36 @@ class App extends Component { )} +