Rev 1541 | Rev 1543 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |
import React, { useState } from 'react'import {List,ListItem,ListItemButton,ListItemText,Typography} from '@mui/material'import WidgetWrapper from 'components/widgets/WidgetLayout'const SideMenu = ({ items = [], onChange = null, title = '' }) => {const [currentIndex, setCurrentIndex] = useState(0)const handleChange = (index, value) => {setCurrentIndex(index)onChange(value)}return (<WidgetWrapper p={1}><Typography variant='h2'>{title}</Typography><List sx={{ mt: 1 }}>{items.map(({ value, name }, index) => (<ListItem key={value} sx={{ p: 0 }}><ListItemButton onClick={() => handleChange(index, value)}><ListItemTextid={value}primary={name}sx={{ fontWeight: currentIndex === index ? 'bold' : 'normal' }}/></ListItemButton></ListItem>))}</List></WidgetWrapper>)}export default SideMenu