From 85f38801a34825be69fec27ae523537fbc72f1d6 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 7 Dec 2018 12:47:16 +0300 Subject: mobile navigation --- vnext/src/App.js | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'vnext/src/App.js') diff --git a/vnext/src/App.js b/vnext/src/App.js index 3a825770..0764281a 100644 --- a/vnext/src/App.js +++ b/vnext/src/App.js @@ -11,9 +11,10 @@ import Chat from './components/Chat'; import Post from './components/Post'; import Thread from './components/Thread'; import LoginButton from './components/LoginButton'; -import { AvatarLink } from './components/Avatar'; +import Avatar from './components/Avatar'; import Header from './components/Header'; import SearchBox from './components/SearchBox'; +import NavigationIcon from './components/NavigationIcon'; import cookies from 'react-cookies'; @@ -31,10 +32,12 @@ export default class App extends React.Component { visitor: { uid: Number(cookies.load('_juick_uid')), hash: cookies.load('hash') - } + }, + appMarginLeft: 'inherit' }; this.pm = React.createRef(); this.thread = React.createRef(); + this.sidebar = React.createRef(); } initES = () => { @@ -85,20 +88,22 @@ export default class App extends React.Component { location.search = `?search=${searchString}`; history.push(location); } + toggleSidebar = () => { + let width = this.sidebar.current.style.width; + this.sidebar.current.style.width = width === '248px' ? '0' : '248px'; + this.setState({ + appMarginLeft: this.state.appMarginLeft === 'inherit' ? '250px' : 'inherit' + }); + } render() { const user = this.state.visitor; return ( <> -
+
- {user.uid > 0 ? -
- {user.uname ? : } -
- : - - } + + @@ -133,7 +138,7 @@ export default class App extends React.Component {
-
+
} /> @@ -154,7 +159,8 @@ export default class App extends React.Component { } />
-
-