瀏覽代碼

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

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

@@ -12,15 +12,20 @@ import useAuth from '../../Auth/useAuth'
12 12
 
13 13
 export function MenuMovil(props) {
14 14
 
15
-    let { anchor } = props;
15
+    let { anchor, control } = props;
16 16
     const auth = useAuth();
17 17
 
18 18
     return (
19 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 26
                 sx={{
22 27
                     '& .MuiDrawer-paper': {
23
-                        width : '50%'
28
+                        width : '67%'
24 29
                     }
25 30
                 }}>
26 31
                 <List style={{ paddingTop : 64 }}>