component: add SideDrawer toogle button
This commit is contained in:
parent
b79cb5e3ff
commit
4deeab8324
@ -7,17 +7,23 @@ import SideDrawer from '../Navigation/SideDrawer/SideDrawer';
|
|||||||
|
|
||||||
class Layout extends Component {
|
class Layout extends Component {
|
||||||
state = {
|
state = {
|
||||||
showSideDrawer: true
|
showSideDrawer: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
sideDrawerClosedHandler = () => {
|
sideDrawerClosedHandler = () => {
|
||||||
this.setState({showSideDrawer: false});
|
this.setState({showSideDrawer: false});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sideDrawerToggleHandler = () => {
|
||||||
|
this.setState((prevState) => {
|
||||||
|
return {showSideDrawer: !prevState.showSideDrawer };
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<Aux>
|
<Aux>
|
||||||
<Toolbar />
|
<Toolbar drawerToggleClicked={this.sideDrawerToggleHandler} />
|
||||||
<SideDrawer open={this.state.showSideDrawer} closed={this.sideDrawerClosedHandler} />
|
<SideDrawer open={this.state.showSideDrawer} closed={this.sideDrawerClosedHandler} />
|
||||||
<main className={classes.Content}>
|
<main className={classes.Content}>
|
||||||
{this.state.children}
|
{this.state.children}
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
|
||||||
|
const drawerToggle = (props) => (
|
||||||
|
<div onClick={props.clicked}>MENU</div>
|
||||||
|
)
|
||||||
|
|
||||||
|
export default drawerToggle;
|
@ -3,11 +3,12 @@ import React from 'react';
|
|||||||
import classes from './Toolbar.css';
|
import classes from './Toolbar.css';
|
||||||
import Logo from '../../Logo/Logo';
|
import Logo from '../../Logo/Logo';
|
||||||
import NavigationItems from '../NavigationItems/NavigationItems';
|
import NavigationItems from '../NavigationItems/NavigationItems';
|
||||||
|
import DrawerToggle from '../SideDrawer/DrawerToggle/DrawerToggle';
|
||||||
|
|
||||||
const toolbar = () => {
|
const toolbar = (props) => {
|
||||||
return (
|
return (
|
||||||
<header className={classes.Toolbar}>
|
<header className={classes.Toolbar}>
|
||||||
<div>MENU</div>
|
<DrawerToggle clicked={props.drawerToggleClicked} />
|
||||||
<div className={classes.Logo}>
|
<div className={classes.Logo}>
|
||||||
<Logo />
|
<Logo />
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user