From 2c5d92c852857cdb5b8ea78d744fb4fc122590c9 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 1 Feb 2019 12:42:18 +0300 Subject: Sidebar navigation fixes --- vnext/src/App.js | 25 ++++++++++++++----------- vnext/src/components/MessageInput.js | 2 +- vnext/src/components/Settings.js | 2 +- vnext/src/style/main.css | 6 +++--- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/vnext/src/App.js b/vnext/src/App.js index 835d3b9f..af364fe2 100644 --- a/vnext/src/App.js +++ b/vnext/src/App.js @@ -91,13 +91,16 @@ export default class App extends React.Component { history.push(location); } toggleSidebar = () => { - let width = this.sidebar.current.style.width; - this.sidebar.current.style.width = width === '248px' ? '0' : '248px'; - let leftMargin = this.state.appMarginLeft === 'inherit' ? '250px' : 'inherit'; - this.setState({ - appMarginLeft: leftMargin - }); - app.style.marginLeft = leftMargin; + const isMobile = window.matchMedia('width < 62.5rem'); + if (isMobile.matches) { + let width = this.sidebar.current.style.width; + this.sidebar.current.style.width = width === '248px' ? '0' : '248px'; + let leftMargin = this.state.appMarginLeft === 'inherit' ? '250px' : 'inherit'; + this.setState({ + appMarginLeft: leftMargin + }); + app.style.marginLeft = leftMargin; + } } render() { const user = this.state.visitor; @@ -171,19 +174,19 @@ export default class App extends React.Component { user.uid > 0 &&