From 8fdec9a47e224b98affc023c37e5d192c265fa42 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 5 Sep 2018 17:13:55 +1200 Subject: Add drawer menu --- modern/src/MainToolbar.js | 94 +++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 82 insertions(+), 12 deletions(-) (limited to 'modern/src/MainToolbar.js') diff --git a/modern/src/MainToolbar.js b/modern/src/MainToolbar.js index 0a21d94..1ba1550 100644 --- a/modern/src/MainToolbar.js +++ b/modern/src/MainToolbar.js @@ -1,4 +1,4 @@ -import React, { Component } from 'react'; +import React, { Component, Fragment } from 'react'; import { withStyles } from '@material-ui/core/styles'; import AppBar from '@material-ui/core/AppBar'; import Toolbar from '@material-ui/core/Toolbar'; @@ -6,19 +6,52 @@ import Typography from '@material-ui/core/Typography'; import Button from '@material-ui/core/Button'; import IconButton from '@material-ui/core/IconButton'; import MenuIcon from '@material-ui/icons/Menu'; +import Drawer from '@material-ui/core/Drawer'; +import List from '@material-ui/core/List'; +import Divider from '@material-ui/core/Divider'; +import ListItem from '@material-ui/core/ListItem'; +import ListItemIcon from '@material-ui/core/ListItemIcon'; +import ListItemText from '@material-ui/core/ListItemText'; +import DashboardIcon from '@material-ui/icons/Dashboard'; +import BarChartIcon from '@material-ui/icons/BarChart'; +import SettingsIcon from '@material-ui/icons/Settings'; const styles = { flex: { flexGrow: 1 + }, + list: { + width: 250 + }, + menuButton: { + marginLeft: -12, + marginRight: 20, } }; class MainToobar extends Component { constructor(props) { super(props); + this.state = { + drawer: false + }; + this.openDrawer = this.openDrawer.bind(this); + this.closeDrawer = this.closeDrawer.bind(this); this.handleLogout = this.handleLogout.bind(this); } + openDrawer() { + this.setState({ + drawer: true + }); + }; + + closeDrawer() { + this.setState({ + drawer: false + }); + }; + handleLogout() { fetch("/api/session", { method: "DELETE" @@ -32,17 +65,54 @@ class MainToobar extends Component { render() { const { classes } = this.props; return ( - - - - - - - Traccar - - - - + + + + + + + + Traccar + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+
); } } -- cgit v1.2.3