Rev 1531 | Rev 1536 | 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, 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><Typography variant='h2'>{title}</Typography><List>{items.map(({ value, name }, index) => (<ListItemkey={value}sx={{ fontWeight: currentIndex === index ? 'bold' : 'normal' }}><ListItemButton onClick={() => handleChange(index, value)}>{name}</ListItemButton></ListItem>))}</List></WidgetWrapper>)}export default SideMenu