import * as React from "react"; import { Box } from "@mui/material"; import PersonOutlineOutlinedIcon from '@mui/icons-material/PersonOutlineOutlined'; import SettingsOutlinedIcon from '@mui/icons-material/SettingsOutlined'; import BathtubOutlinedIcon from '@mui/icons-material/BathtubOutlined'; import AddPhotoAlternateOutlinedIcon from '@mui/icons-material/AddPhotoAlternateOutlined'; import NaturePeopleOutlinedIcon from '@mui/icons-material/NaturePeopleOutlined'; import SettingsIcon from '@mui/icons-material/Settings'; import CameraIcon from '@mui/icons-material/Camera'; import HeadsetMicOutlinedIcon from '@mui/icons-material/HeadsetMicOutlined'; import theme from "../../../theme"; import CssBaseline from "@mui/material/CssBaseline"; import Toolbar from "@mui/material/Toolbar"; import IconButton from "@mui/material/IconButton"; import MenuIcon from "@mui/icons-material/Menu"; import ChevronRightIcon from "@mui/icons-material/ChevronRight"; import ChevronLeftIcon from "@mui/icons-material/ChevronLeft"; import Divider from "@mui/material/Divider"; import List from "@mui/material/List"; import ListItem from "@mui/material/ListItem"; import ListItemButton from "@mui/material/ListItemButton"; import ListItemIcon from "@mui/material/ListItemIcon"; import ListItemText from "@mui/material/ListItemText"; import {CSSObject, styled, Theme, useTheme} from "@mui/material/styles"; import MuiDrawer from '@mui/material/Drawer'; import MuiAppBar, { AppBarProps as MuiAppBarProps } from '@mui/material/AppBar'; import Header from "../Header/index"; import {Link} from 'react-router-dom'; import useMediaQuery from '@mui/material/useMediaQuery'; import Paper from "@mui/material/Paper"; const drawerWidth = 240; const openedMixin = (theme: Theme): CSSObject => ({ width: drawerWidth, background: '#2f3339', transition: theme.transitions.create('width', { easing: theme.transitions.easing.sharp, duration: theme.transitions.duration.enteringScreen, }), overflowX: 'hidden', }); const closedMixin = (theme: Theme): CSSObject => ({ transition: theme.transitions.create('width', { easing: theme.transitions.easing.sharp, duration: theme.transitions.duration.leavingScreen, }), overflowX: 'hidden', width: `calc(${theme.spacing(7)} + 1px)`, background: '#2f3339', // marginTop: '20px', [theme.breakpoints.up('sm')]: { width: `calc(${theme.spacing(8)} + 1px)`, }, }); const DrawerHeader = styled('div')(({ theme }) => ({ display: 'flex', alignItems: 'center', justifyContent: 'flex-end', padding: theme.spacing(0, 1), ...theme.mixins.toolbar, })); interface AppBarProps extends MuiAppBarProps { open?: boolean; } const AppBar = styled(MuiAppBar, { shouldForwardProp: (prop) => prop !== 'open', })(({ theme, open }) => ({ zIndex: theme.zIndex.drawer + 1, transition: theme.transitions.create(['width', 'margin'], { easing: theme.transitions.easing.sharp, duration: theme.transitions.duration.leavingScreen, }), ...(open && { marginLeft: drawerWidth, width: `calc(100% - ${drawerWidth}px)`, transition: theme.transitions.create(['width', 'margin'], { easing: theme.transitions.easing.sharp, duration: theme.transitions.duration.enteringScreen, }), }), })); const Drawer = styled(MuiDrawer, { shouldForwardProp: (prop) => prop !== 'open' })( ({ theme, open }) => ({ width: drawerWidth, flexShrink: 0, boxSizing: 'border-box', ...(open && { ...openedMixin(theme), '& .MuiDrawer-paper': openedMixin(theme), }), ...(!open && { ...closedMixin(theme), '& .MuiDrawer-paper': closedMixin(theme), }), }), ); const links: {path: string; element: JSX.Element; title: string, className: string} [] =[ {path: '/users', element: , title: 'Информация о проекте', className:'menu'}, {path: '/entities', element: , title: 'Юридические лица', className:'menu'}, {path: '/tariffs', element: , title: 'Шаблонизатор документов', className:'menu'}, {path: '/discounts', element: , title: 'Скидки', className:'menu'}, {path: '/promocode', element: , title: 'Промокод', className:'menu'}, {path: '/kkk', element: , title: 'Настройки', className:'menu'}, {path: '/jjj', element: , title: 'Камера', className:'menu'}, {path: '/support', element: , title: 'Служба поддержки', className:'menu'}, ] const Navigation = (props:any) => { return ( {links.map((e, i) => ( {e.element} ))} ) } const Menu: React.FC = () => { const tablet = useMediaQuery('(max-width:600px)'); const mobile = useMediaQuery('(max-width:340px)'); const theme = useTheme(); const [open, setOpen] = React.useState(tablet? false : true); const handleDrawerOpen = () => { if (!mobile) {setOpen(true)} else {SladeMobileHC()} }; const handleDrawerClose = () => { setOpen(false); }; const [sladeMobile, setSladeMobile] = React.useState(false) const SladeMobileHC = () => { if (mobile) {setSladeMobile(old=>!old)} }; return (
{!mobile ? : null} {sladeMobile ? : null} ); } export default Menu;