import React from "react"; import { createStyles, CssBaseline, Divider, Drawer, Fab, IconButton, Theme, Tooltip, withStyles } from "@material-ui/core"; import clsx from "clsx"; import {Map} from "./Map"; import MenuIcon from "@material-ui/icons/Menu"; import ChevronLeftIcon from "@material-ui/icons/ChevronLeft"; import {OGC3DContainerLayer} from "./layers/OGC3DContainerLayer"; import {STALayer} from "./layers/STALayer"; const SIDEBAR_WIDTH = 300; const styles = (theme: Theme) => createStyles({ root: { display: "flex", width: "100%" }, menuButton: { position: "absolute", "z-index": 1000, left: 30, top: 14, backgroundColor: "ghostwhite" }, hide: { display: "none", }, drawer: { width: SIDEBAR_WIDTH, flexShrink: 0 }, drawerPaper: { width: SIDEBAR_WIDTH, backgroundColor: "#f6f6f6" }, drawerHeader: { display: "flex", alignItems: "center", padding: theme.spacing(0, 1), // necessary for content to be below app bar justifyContent: "flex-end", }, content: { flexGrow: 1, backgroundColor: "#defff4", transition: theme.transitions.create("margin", { easing: theme.transitions.easing.sharp, duration: theme.transitions.duration.leavingScreen, }), marginLeft: -SIDEBAR_WIDTH, }, contentShift: { transition: theme.transitions.create("margin", { easing: theme.transitions.easing.easeOut, duration: theme.transitions.duration.enteringScreen }), marginLeft: 0 }, }); type SidebarProps = { classes: any } type SidebarState = { isOpen: boolean; map: Map | null }; class SidebarClass extends React.Component { constructor(props: SidebarProps) { super(props); this.state = { isOpen: false, map: null }; } private handleDrawerToggle() { this.setState(state => ({isOpen: !state.isOpen})); } render() { return (
{this.state.map ? [ , ] : null}
{ if (map && !this.state.map) this.setState({map}); }}/>
); } } export const Sidebar = withStyles(styles)(SidebarClass);