Rev 1536 | Rev 1541 | 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) => (<ListItemkey={value}sx={{ fontWeight: currentIndex === index ? 'bold' : 'normal' }}><ListItemButton onClick={() => handleChange(index, value)}><ListItemText id={value} primary={name} /></ListItemButton></ListItem>))}</List></WidgetWrapper>)}export default SideMenu