diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2019-07-19 09:25:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-19 09:25:22 +0200 |
commit | aa22b38fdbc1842549b6cbc0e0d948f85a71b92a (patch) | |
tree | ab38f411a1c5726820dfade57fef2d6d2cb670c2 /app/javascript/mastodon/features/ui/index.js | |
parent | 4fa6472523d47e56f2458950af8d7ad9b5817a82 (diff) |
Change single-column mode to scroll the whole page (#11359)
Fix #10840
Diffstat (limited to 'app/javascript/mastodon/features/ui/index.js')
-rw-r--r-- | app/javascript/mastodon/features/ui/index.js | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/app/javascript/mastodon/features/ui/index.js b/app/javascript/mastodon/features/ui/index.js index 791133afd..d1a3dc949 100644 --- a/app/javascript/mastodon/features/ui/index.js +++ b/app/javascript/mastodon/features/ui/index.js @@ -110,12 +110,25 @@ class SwitchingColumnsArea extends React.PureComponent { componentWillMount () { window.addEventListener('resize', this.handleResize, { passive: true }); + + if (this.state.mobile || forceSingleColumn) { + document.body.classList.toggle('layout-single-column', true); + document.body.classList.toggle('layout-multiple-columns', false); + } else { + document.body.classList.toggle('layout-single-column', false); + document.body.classList.toggle('layout-multiple-columns', true); + } } - componentDidUpdate (prevProps) { + componentDidUpdate (prevProps, prevState) { if (![this.props.location.pathname, '/'].includes(prevProps.location.pathname)) { this.node.handleChildrenContentChange(); } + + if (prevState.mobile !== this.state.mobile && !forceSingleColumn) { + document.body.classList.toggle('layout-single-column', this.state.mobile); + document.body.classList.toggle('layout-multiple-columns', !this.state.mobile); + } } componentWillUnmount () { |