ソースを参照

pre react router fixes

amenpunk 3 年 前
コミット
bf13f37df3
共有4 個のファイルを変更した103 個の追加36 個の削除を含む
  1. 0 1
      psicoadmin/src/App.css
  2. 27 21
      psicoadmin/src/Components/Dashboard.js
  3. 2 1
      psicoadmin/src/Components/NavStyle.js
  4. 74 13
      psicoadmin/src/Components/listItems.js

+ 0 - 1
psicoadmin/src/App.css

@@ -62,4 +62,3 @@
62 62
     line-height: 30px !important;
63 63
     font-size : 12px !important;
64 64
 }
65
-

+ 27 - 21
psicoadmin/src/Components/Dashboard.js

@@ -16,7 +16,6 @@ import Avatar from '@mui/material/Avatar';
16 16
 import MenuIcon from '@mui/icons-material/Menu';
17 17
 import FullscreenIcon from '@mui/icons-material/Fullscreen';
18 18
 
19
-import ChevronLeftIcon from '@mui/icons-material/ChevronLeft';
20 19
 import NotificationsIcon from '@mui/icons-material/Notifications';
21 20
 import { MainListItems, secondaryListItems } from './listItems';
22 21
 
@@ -104,31 +103,40 @@ function DashboardContent() {
104 103
         <ThemeProvider theme={mdTheme}>
105 104
             <Box sx={{ display: 'flex' }}>
106 105
                 <CssBaseline />
107
-                <AppBar style={{ backgroundColor : '#fff' }} position="absolute" open={open}>
106
+                <AppBar style={{ backgroundColor : '#fff', boxShadow : 'None' }} position="absolute" open={open}>
108 107
                     <Toolbar sx={{ pr: '24px' ,  borderBottom : "1px solid #ec5e69"}} >
109 108
 
110
-                        <IconButton style={{ color : '#212529' }} edge="start" color="inherit" aria-label="open drawer" onClick={toggleDrawer} sx={{ marginRight: '36px', ...(open && { display: 'none' }), }} >
111
-                            <MenuIcon />
109
+                        <IconButton style={{ 
110
+                                // color : '#212529',
111
+                        }} edge="start" color="inherit" aria-label="open drawer" onClick={toggleDrawer} sx={{ 
112
+                                marginRight: '36px', ...(open && { display: 'none' }), 
113
+                        }} >
114
+                            <MenuIcon  style={{
115
+                                background: '#ec5e69',
116
+                                fontSize: "40",
117
+                                color: "#fff"
118
+                            }}/>
112 119
                         </IconButton>
113 120
 
114 121
                         <Typography component="h1" variant="h6" color="inherit" noWrap sx={{ flexGrow: 1 }} >
115 122
 
116
-                        <IconButton onClick={toggleDrawer}>
117 123
                             {
118
-                                open ? 
119
-                                    (
124
+                                open ? (
120 125
                                     <React.Fragment>
121
-                                        <MenuIcon />
122
-                                        <FullscreenIcon style={{ marginLeft : 15 }}/>
123
-                                    </React.Fragment>
124
-                                    )
125
-                                : undefined
126 126
 
127
-                            }
128
-                        </IconButton>
127
+                                        <IconButton onClick={toggleDrawer}>
128
+                                            <MenuIcon />
129
+                                        </IconButton>
129 130
 
131
+                                        <IconButton onClick={ (event) =>  event.target.requestFullscreen() }>
132
+                                            <FullscreenIcon style={{ paddinLeft : 15 }}/>
133
+                                        </IconButton>
130 134
 
131 135
 
136
+                                    </React.Fragment>
137
+                                ) : undefined
138
+                            }
139
+
132 140
 
133 141
                         </Typography>
134 142
 
@@ -190,17 +198,14 @@ function DashboardContent() {
190 198
                             alignItems: 'center',
191 199
                             justifyContent: 'flex-start',
192 200
                             px: [1],
193
-                            
201
+
194 202
                         }} >
195 203
 
196 204
                         <div style={{ flat : 'righ' }} className="sidebar-header">
197
-                                <div className="width_img">
198
-                                    <img src={Logo} alt=""/>
199
-                                </div>
205
+                            <div className="width_img">
206
+                                <img src={Logo} alt=""/>
200 207
                             </div>
201
-
202
-
203
-
208
+                        </div>
204 209
 
205 210
                     </Toolbar>
206 211
                     <Divider />
@@ -214,6 +219,7 @@ function DashboardContent() {
214 219
                     <Toolbar />
215 220
 
216 221
                     <Container maxWidth="lg" sx={{ mt: 4, mb: 4 }}>
222
+                        <h1> Bienviendo </h1>
217 223
                     </Container>
218 224
 
219 225
                 </Box>

+ 2 - 1
psicoadmin/src/Components/NavStyle.js

@@ -1,6 +1,6 @@
1 1
 import Color from 'color';
2 2
 
3
-export default () => ({
3
+const NavStyle = () => ({
4 4
     root: ({ collapsed }) => ({
5 5
         borderTopRightRadius: 20,
6 6
         borderBottomRightRadius: 20,
@@ -37,3 +37,4 @@ export default () => ({
37 37
     }),
38 38
 });
39 39
 
40
+export default NavStyle

+ 74 - 13
psicoadmin/src/Components/listItems.js

@@ -1,5 +1,4 @@
1 1
 import * as React from 'react';
2
-import ListItemButton from '@mui/material/ListItemButton';
3 2
 import ListItem from '@mui/material/ListItem';
4 3
 import List from '@mui/material/List';
5 4
 
@@ -23,8 +22,37 @@ import OndemandVideoIcon from '@mui/icons-material/OndemandVideo';
23 22
 import StarIcon from '@mui/icons-material/Star';
24 23
 import SupportAgentIcon from '@mui/icons-material/SupportAgent';
25 24
 
26
-import NavStyle from './NavStyle' 
25
+import Collapse from '@mui/material/Collapse';
26
+import ExpandLess from '@mui/icons-material/ExpandLess';
27
+import ExpandMore from '@mui/icons-material/ExpandMore';
27 28
 
29
+function SubMenuItem (props) {
30
+
31
+    function change (event){
32
+        props.change(event, props.index)
33
+    } 
34
+
35
+    let isOn = props.selected === props.index
36
+
37
+    return(
38
+        <ListItem 
39
+            sx={{ pl: 9}}
40
+            selected={isOn}
41
+            onClick={change} 
42
+            button
43
+        >
44
+            <ListItemText 
45
+                sx={{
46
+                    fontSize: 12,
47
+                    ' .css-10hburv-MuiTypography-root' : {
48
+                        fontSize : '.875rem'
49
+                    },
50
+                }}
51
+                primary={props.title} 
52
+            />
53
+        </ListItem>
54
+    )
55
+}
28 56
 
29 57
 function Item (props) {
30 58
 
@@ -32,18 +60,13 @@ function Item (props) {
32 60
     function change (event){
33 61
         props.change(event, props.index)
34 62
     } 
63
+
35 64
     let isOn = props.selected === props.index
36 65
 
37 66
     //.css-10oikv1-MuiButtonBase-root-MuiListItem-root.Mui-selected
38 67
     return(
39 68
         <ListItem
40
-            sx={{
41
-                color : '#25344f',
42
-                '& .MuiButtonBase-selected' :{
43
-                    color : '#121212',
44
-                    backgroundColor : '#101010'
45
-                }
46
-            }}
69
+            sx={{ color : '#25344f'}}
47 70
             selected={isOn}
48 71
             onClick={change} 
49 72
             button
@@ -66,7 +89,7 @@ function Item (props) {
66 89
 
67 90
 
68 91
 export const MainListItems = () =>  {
69
-    
92
+
70 93
     const [selectedIndex, setSelectedIndex] = React.useState(1);
71 94
 
72 95
 
@@ -74,6 +97,12 @@ export const MainListItems = () =>  {
74 97
         setSelectedIndex(index);
75 98
     };
76 99
 
100
+    const [open, setOpen] = React.useState(true);
101
+
102
+    const showPruebas = () => {
103
+        setOpen(!open);
104
+    };
105
+
77 106
 
78 107
     return(
79 108
         <List>
@@ -83,9 +112,41 @@ export const MainListItems = () =>  {
83 112
             <Item icon={<VisibilityOffIcon/>} selected={selectedIndex}  change={handleListItemClick} index={2} title="Contraseñas" route="/contrasenas" />
84 113
             <Item icon={<PeopleAltIcon/>} selected={selectedIndex}  change={handleListItemClick} index={3} title="Expedientes" route="/expedientes" />
85 114
             <Item icon={<EqualizerIcon/>} selected={selectedIndex}  change={handleListItemClick} index={4} title="Resultados" route="/resultados" />
86
-            <Item icon={<FingerprintIcon/>} selected={selectedIndex}  change={handleListItemClick} index={5} title="Pruebas" route="/pruebas" />
87
-            <Item icon={<MiscellaneousServicesIcon/>} selected={selectedIndex}  change={handleListItemClick} index={6} title="Configuraciones" route="/configuraciones" />
88
-            <Item icon={<HistoryIcon/>} selected={selectedIndex}  change={handleListItemClick} index={7} title="Historial" route="/historial" />
115
+            {/* <Item icon={<FingerprintIcon/>} selected={selectedIndex}  change={handleListItemClick} index={5} title="Pruebas" route="/pruebas" /> */}
116
+
117
+
118
+            <ListItem onClick={showPruebas}>
119
+                <ListItemIcon>
120
+                    <FingerprintIcon />
121
+                </ListItemIcon>
122
+
123
+
124
+                <ListItemText 
125
+                sx={{
126
+                    fontSize: 12,
127
+                    ' .css-10hburv-MuiTypography-root' : {
128
+                        fontSize : '.875rem'
129
+                    },
130
+                }}
131
+                primary="Pruebas" />
132
+                {open ? <ExpandLess /> : <ExpandMore />}
133
+            </ListItem>
134
+
135
+
136
+            <Collapse in={open} timeout="auto" unmountOnExit>
137
+                <List component="div" disablePadding>
138
+                        
139
+                    <SubMenuItem selected={selectedIndex} index={5} change={handleListItemClick} title="Crear Prueba" />
140
+                    <SubMenuItem selected={selectedIndex} index={6} change={handleListItemClick} title="Listado de pruebas" />
141
+                    <SubMenuItem selected={selectedIndex} index={7} change={handleListItemClick} title="Aplicar" />
142
+                    <SubMenuItem selected={selectedIndex} index={8} change={handleListItemClick} title="Respuestas" />
143
+                    <SubMenuItem selected={selectedIndex} index={9} change={handleListItemClick} title="Calificaciones" />
144
+
145
+                </List>
146
+            </Collapse>
147
+
148
+            <Item icon={<MiscellaneousServicesIcon/>} selected={selectedIndex}  change={handleListItemClick} index={10} title="Configuraciones" route="/configuraciones" />
149
+            <Item icon={<HistoryIcon/>} selected={selectedIndex}  change={handleListItemClick} index={11} title="Historial" route="/historial" />
89 150
         </List>
90 151
     )
91 152
 };