feat: adding the drawer menu
This commit is contained in:
		
							
								
								
									
										41
									
								
								src/components/MenuDrawer.jsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								src/components/MenuDrawer.jsx
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,41 @@ | ||||
| import { Drawer, List, ListItem, ListItemText, useMediaQuery } from '@mui/material'; | ||||
|  | ||||
| const menuOptions = { | ||||
|   public: ['Home', 'Explore', 'Contact'], | ||||
|   restricted: ['Dashboard', 'Projects', 'Support'], | ||||
|   private: ['Admin', 'Users', 'Settings'], | ||||
| }; | ||||
|  | ||||
| export default function MenuDrawer({ zone = 'public', open, onClose }) { | ||||
|   const isMobile = useMediaQuery('(max-width:900px)'); | ||||
|   const items = menuOptions[zone]; | ||||
|  | ||||
|   return ( | ||||
|     <Drawer anchor="left" open={open} onClose={onClose} slotProps={{ | ||||
|         paper: { | ||||
|           sx: { | ||||
|             backgroundColor: '#000000a0', // negro semitransparente | ||||
|             width: isMobile ? '100vw' : 250, | ||||
|           }, | ||||
|         }, | ||||
|       }}> | ||||
|      <List sx={{ width: isMobile ? '100vw' : 250, marginTop: 14 }}> | ||||
|         {items.map((text, index) => ( | ||||
|           <ListItem key={index} onClick={onClose}> | ||||
|              <ListItemText | ||||
|               primary={text} | ||||
|               slotProps={{ | ||||
|                 primary: { | ||||
|                   sx: { | ||||
|                     color: '#ccc', | ||||
|                     fontWeight: 'medium', | ||||
|                   }, | ||||
|                 }, | ||||
|               }} | ||||
|             /> | ||||
|           </ListItem> | ||||
|         ))} | ||||
|       </List> | ||||
|     </Drawer> | ||||
|   ); | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Rodolfo Ruiz
					Rodolfo Ruiz