浏览代码

swappeable fixes in movil device

amenpunk 2 年之前
父节点
当前提交
b90c04e3e2
共有 2 个文件被更改,包括 21 次插入9 次删除
  1. 13 6
      src/Components/Dashboard.js
  2. 8 3
      src/Components/Navigation/MenuMovil.jsx

+ 13 - 6
src/Components/Dashboard.js

27
 
27
 
28
     const [open, setOpen] = React.useState(false);
28
     const [open, setOpen] = React.useState(false);
29
     const isMovil = Size('(min-width:770px)');
29
     const isMovil = Size('(min-width:770px)');
30
-
31
-    const toggleDrawer = () => setOpen(!open);
32
     const auth = useAuth();
30
     const auth = useAuth();
33
     const navigate = useNavigate()
31
     const navigate = useNavigate()
34
 
32
 
33
+    const toggleDrawer = () => setOpen(!open);
35
     const [anchorEl, setAnchorEl] = React.useState(null);
34
     const [anchorEl, setAnchorEl] = React.useState(null);
36
     const open_profile = Boolean(anchorEl);
35
     const open_profile = Boolean(anchorEl);
37
     const handleClick = (event) => setAnchorEl(event.currentTarget);
36
     const handleClick = (event) => setAnchorEl(event.currentTarget);
38
     const handleClose = () => setAnchorEl(null)
37
     const handleClose = () => setAnchorEl(null)
39
 
38
 
40
     const [anchorElMovil, setAnchorElMov] = React.useState(false);
39
     const [anchorElMovil, setAnchorElMov] = React.useState(false);
41
-
42
-    const MenuResponsive = ()  => {
40
+    const MenuResponsive = () => {
41
+        console.log(anchorElMovil)
43
         setAnchorElMov(!anchorElMovil);
42
         setAnchorElMov(!anchorElMovil);
44
-    } 
43
+    }
45
 
44
 
46
     const CerrarSession = () => {
45
     const CerrarSession = () => {
47
         console.log('cerrando session')
46
         console.log('cerrando session')
51
 
50
 
52
     return (
51
     return (
53
         <ThemeProvider theme={mdTheme}>
52
         <ThemeProvider theme={mdTheme}>
54
-            <MenuMovil anchor={anchorElMovil}/>
53
+
54
+            <MenuMovil 
55
+                anchor={anchorElMovil}
56
+                control={setAnchorElMov} />
57
+
55
             <Box sx={{ display: 'flex' }}>
58
             <Box sx={{ display: 'flex' }}>
56
                 <CssBaseline/>
59
                 <CssBaseline/>
57
                 <AppBar style={{ backgroundColor : '#fff', boxShadow : 'None' }} position="absolute" open={ !isMovil ? open : false}>
60
                 <AppBar style={{ backgroundColor : '#fff', boxShadow : 'None' }} position="absolute" open={ !isMovil ? open : false}>
58
                     <Toolbar sx={{ pr: '24px' ,  borderBottom : "1px solid #ec5e69"}} >
61
                     <Toolbar sx={{ pr: '24px' ,  borderBottom : "1px solid #ec5e69"}} >
62
+
59
                         {/* boton para activar navegacion */}
63
                         {/* boton para activar navegacion */}
60
                         <IconButton 
64
                         <IconButton 
61
                             edge="start" 
65
                             edge="start" 
69
                                 color: "#fff"
73
                                 color: "#fff"
70
                             }}/>
74
                             }}/>
71
                         </IconButton>
75
                         </IconButton>
76
+
72
                         <Typography component="h1" variant="h6" color="inherit" noWrap sx={{ flexGrow: 1 }} >
77
                         <Typography component="h1" variant="h6" color="inherit" noWrap sx={{ flexGrow: 1 }} >
73
                             {
78
                             {
74
                             !isMovil && open ? (
79
                             !isMovil && open ? (
75
                                 <React.Fragment>
80
                                 <React.Fragment>
81
+
76
                                     <IconButton onClick={toggleDrawer}>
82
                                     <IconButton onClick={toggleDrawer}>
77
                                         <MenuIcon />
83
                                         <MenuIcon />
78
                                     </IconButton>
84
                                     </IconButton>
85
+
79
                                     <IconButton onClick={ (event) =>  event.target.requestFullscreen() }>
86
                                     <IconButton onClick={ (event) =>  event.target.requestFullscreen() }>
80
                                         <FullscreenIcon style={{ paddinLeft : 15 }}/>
87
                                         <FullscreenIcon style={{ paddinLeft : 15 }}/>
81
                                     </IconButton>
88
                                     </IconButton>

+ 8 - 3
src/Components/Navigation/MenuMovil.jsx

12
 
12
 
13
 export function MenuMovil(props) {
13
 export function MenuMovil(props) {
14
 
14
 
15
-    let { anchor } = props;
15
+    let { anchor, control } = props;
16
     const auth = useAuth();
16
     const auth = useAuth();
17
 
17
 
18
     return (
18
     return (
19
         <React.Fragment >
19
         <React.Fragment >
20
-            <SwipeableDrawer anchor="left" open={anchor} 
20
+            <SwipeableDrawer 
21
+                disableBackdropTransition={true}
22
+                anchor="left" 
23
+                open={anchor} 
24
+                onOpen={() => control(true)}
25
+                onClose={() => control(false)}
21
                 sx={{
26
                 sx={{
22
                     '& .MuiDrawer-paper': {
27
                     '& .MuiDrawer-paper': {
23
-                        width : '50%'
28
+                        width : '67%'
24
                     }
29
                     }
25
                 }}>
30
                 }}>
26
                 <List style={{ paddingTop : 64 }}>
31
                 <List style={{ paddingTop : 64 }}>