redesigned drawer
This commit is contained in:
@@ -3,6 +3,7 @@ import {
|
|||||||
BrowserRouter
|
BrowserRouter
|
||||||
} from "react-router-dom";
|
} from "react-router-dom";
|
||||||
import Navbar from "./components/navigation";
|
import Navbar from "./components/navigation";
|
||||||
|
import { createMuiTheme, ThemeProvider } from '@material-ui/core/styles';
|
||||||
|
|
||||||
import "./App.css";
|
import "./App.css";
|
||||||
|
|
||||||
@@ -10,11 +11,27 @@ import "./App.css";
|
|||||||
|
|
||||||
class App extends Component {
|
class App extends Component {
|
||||||
render() {
|
render() {
|
||||||
|
const theme = createMuiTheme({
|
||||||
|
palette: {
|
||||||
|
primary: {
|
||||||
|
main: "#0B1929",
|
||||||
|
light: "#9daac1"
|
||||||
|
},
|
||||||
|
secondary: {
|
||||||
|
main: "#FFC800",
|
||||||
|
light: "#ffdf7b"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
//change basename in browserrouter if uri changes
|
//change basename in browserrouter if uri changes
|
||||||
return (
|
return (
|
||||||
|
<ThemeProvider theme={theme}>
|
||||||
<BrowserRouter basename="/simcompanies">
|
<BrowserRouter basename="/simcompanies">
|
||||||
<Navbar></Navbar>
|
<Navbar></Navbar>
|
||||||
</BrowserRouter>
|
</BrowserRouter>
|
||||||
|
</ThemeProvider>
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import CssBaseline from '@material-ui/core/CssBaseline';
|
|||||||
import AppBar from '@material-ui/core/AppBar';
|
import AppBar from '@material-ui/core/AppBar';
|
||||||
import Toolbar from '@material-ui/core/Toolbar';
|
import Toolbar from '@material-ui/core/Toolbar';
|
||||||
import List from '@material-ui/core/List';
|
import List from '@material-ui/core/List';
|
||||||
import Typography from '@material-ui/core/Typography';
|
|
||||||
import Divider from '@material-ui/core/Divider';
|
import Divider from '@material-ui/core/Divider';
|
||||||
import IconButton from '@material-ui/core/IconButton';
|
import IconButton from '@material-ui/core/IconButton';
|
||||||
import MenuIcon from '@material-ui/icons/Menu';
|
import MenuIcon from '@material-ui/icons/Menu';
|
||||||
@@ -20,21 +19,26 @@ import Link1 from '@material-ui/core/Link';
|
|||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import SearchIcon from '@material-ui/icons/Search';
|
import SearchIcon from '@material-ui/icons/Search';
|
||||||
import InputBase from '@material-ui/core/InputBase';
|
import InputBase from '@material-ui/core/InputBase';
|
||||||
|
import EmojiObjectsIcon from '@material-ui/icons/EmojiObjects';
|
||||||
|
import { ListItemIcon } from '@material-ui/core';
|
||||||
|
import Tooltip from '@material-ui/core/Tooltip';
|
||||||
|
import Zoom from '@material-ui/core/Zoom';
|
||||||
|
|
||||||
const drawerWidth = 240;
|
const drawerWidth = 64;
|
||||||
|
const drawerWidthOpen = 240;
|
||||||
const useStyles = makeStyles((theme) => ({
|
const useStyles = makeStyles((theme) => ({
|
||||||
root: {
|
root: {
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
},
|
},
|
||||||
appBar: {
|
appBar: {
|
||||||
|
zIndex: theme.zIndex.drawer + 1,
|
||||||
transition: theme.transitions.create(['margin', 'width'], {
|
transition: theme.transitions.create(['margin', 'width'], {
|
||||||
easing: theme.transitions.easing.sharp,
|
easing: theme.transitions.easing.sharp,
|
||||||
duration: theme.transitions.duration.leavingScreen,
|
duration: theme.transitions.duration.leavingScreen,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
appBarShift: {
|
appBarShift: {
|
||||||
width: `calc(100% - ${drawerWidth}px)`,
|
width: `calc(100% - ${drawerWidthOpen}px)`,
|
||||||
marginLeft: drawerWidth,
|
marginLeft: drawerWidth,
|
||||||
transition: theme.transitions.create(['margin', 'width'], {
|
transition: theme.transitions.create(['margin', 'width'], {
|
||||||
easing: theme.transitions.easing.easeOut,
|
easing: theme.transitions.easing.easeOut,
|
||||||
@@ -50,8 +54,21 @@ const useStyles = makeStyles((theme) => ({
|
|||||||
drawer: {
|
drawer: {
|
||||||
width: drawerWidth,
|
width: drawerWidth,
|
||||||
flexShrink: 0,
|
flexShrink: 0,
|
||||||
|
whiteSpace: 'nowrap'
|
||||||
},
|
},
|
||||||
drawerPaper: {
|
drawerOpen: {
|
||||||
|
width: drawerWidthOpen,
|
||||||
|
transition: theme.transitions.create('width', {
|
||||||
|
easing: theme.transitions.easing.sharp,
|
||||||
|
duration: theme.transitions.duration.enteringScreen,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
drawerClose: {
|
||||||
|
transition: theme.transitions.create('width', {
|
||||||
|
easing: theme.transitions.easing.sharp,
|
||||||
|
duration: theme.transitions.duration.leavingScreen,
|
||||||
|
}),
|
||||||
|
overflowX: 'hidden',
|
||||||
width: drawerWidth,
|
width: drawerWidth,
|
||||||
},
|
},
|
||||||
drawerHeader: {
|
drawerHeader: {
|
||||||
@@ -69,7 +86,7 @@ const useStyles = makeStyles((theme) => ({
|
|||||||
easing: theme.transitions.easing.sharp,
|
easing: theme.transitions.easing.sharp,
|
||||||
duration: theme.transitions.duration.leavingScreen,
|
duration: theme.transitions.duration.leavingScreen,
|
||||||
}),
|
}),
|
||||||
marginLeft: -drawerWidth,
|
marginLeft: 0,
|
||||||
},
|
},
|
||||||
contentShift: {
|
contentShift: {
|
||||||
transition: theme.transitions.create('margin', {
|
transition: theme.transitions.create('margin', {
|
||||||
@@ -175,12 +192,16 @@ export default function Navigation() {
|
|||||||
</Toolbar>
|
</Toolbar>
|
||||||
</AppBar>
|
</AppBar>
|
||||||
<Drawer
|
<Drawer
|
||||||
className={classes.drawer}
|
variant="permanent"
|
||||||
variant="persistent"
|
className={clsx(classes.drawer, {
|
||||||
anchor="left"
|
[classes.drawerOpen]: open,
|
||||||
open={open}
|
[classes.drawerClose]: !open,
|
||||||
|
})}
|
||||||
classes={{
|
classes={{
|
||||||
paper: classes.drawerPaper,
|
paper: clsx({
|
||||||
|
[classes.drawerOpen]: open,
|
||||||
|
[classes.drawerClose]: !open,
|
||||||
|
}),
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className={classes.drawerHeader}>
|
<div className={classes.drawerHeader}>
|
||||||
@@ -191,9 +212,16 @@ export default function Navigation() {
|
|||||||
<Divider />
|
<Divider />
|
||||||
<List>
|
<List>
|
||||||
{['Resources'].map((text, index) => (
|
{['Resources'].map((text, index) => (
|
||||||
|
|
||||||
<ListItemLink key={text} to={"/" + text.toLowerCase()} component={Link}>
|
<ListItemLink key={text} to={"/" + text.toLowerCase()} component={Link}>
|
||||||
|
<Tooltip TransitionComponent={Zoom} placement='right' title="Resources" arrow enterDelay="500">
|
||||||
|
<ListItemIcon><EmojiObjectsIcon fontSize="large" color="secondary"></EmojiObjectsIcon></ListItemIcon>
|
||||||
|
</Tooltip>
|
||||||
<ListItemText primary={text} />
|
<ListItemText primary={text} />
|
||||||
|
|
||||||
</ListItemLink>
|
</ListItemLink>
|
||||||
|
|
||||||
|
|
||||||
))}
|
))}
|
||||||
</List>
|
</List>
|
||||||
</Drawer>
|
</Drawer>
|
||||||
|
|||||||
Reference in New Issue
Block a user