Skip to content

Commit

Permalink
Merge branch 'white-tray' of https://github.com/quochuy/condenser int…
Browse files Browse the repository at this point in the history
…o quochuy-white-tray
  • Loading branch information
roadscape committed May 20, 2019
2 parents 1754a26 + 85eee6b commit 35ba8ff
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions src/app/components/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,30 @@ class App extends React.Component {
this.setState({ gptBannerHeight: height });
}

toggleBodyNightmode(nightmodeEnabled) {
if (nightmodeEnabled) {
document.body.classList.remove('theme-light');
document.body.classList.add('theme-dark');
} else {
document.body.classList.remove('theme-dark');
document.body.classList.add('theme-light');
}
}

componentWillReceiveProps(nextProps) {
const { nightmodeEnabled } = nextProps;
this.toggleBodyNightmode(nightmodeEnabled);
}

componentWillMount() {
if (process.env.BROWSER) localStorage.removeItem('autopost'); // July 14 '16 compromise, renamed to autopost2
this.props.loginUser();
}

componentDidMount() {
const { nightmodeEnabled } = this.props;
this.toggleBodyNightmode(nightmodeEnabled);

window.addEventListener('gptadshown', this.gptadshownListener);
}

Expand Down Expand Up @@ -162,13 +180,6 @@ class App extends React.Component {
}

const themeClass = nightmodeEnabled ? ' theme-dark' : ' theme-light';
if (themeClass == 'theme-dark') {
document.body.classList.remove('theme-light');
document.body.classList.add('theme-dark');
} else {
document.body.classList.remove('theme-dark');
document.body.classList.add('theme-light');
}

return (
<div
Expand Down

0 comments on commit 35ba8ff

Please sign in to comment.