Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 1544 | Rev 1575 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |

import React from 'react'
import {
  List,
  ListItem,
  ListItemButton,
  ListItemText,
  Typography
} from '@mui/material'

import WidgetWrapper from '@app/components/widgets/WidgetLayout'

const SideMenu = ({
  items = [],
  onChange = null,
  title = '',
  current = ''
}) => {
  const handleChange = (value) => onChange(value)

  return (
    <WidgetWrapper p={1}>
      <Typography variant='h2'>{title}</Typography>

      <List sx={{ mt: 1 }}>
        {items.map(({ value, name }) => (
          <ListItem key={value} sx={{ p: 0 }}>
            <ListItemButton sx={{ py: 0 }} onClick={() => handleChange(value)}>
              <ListItemText
                id={value}
                primary={name}
                primaryTypographyProps={{
                  sx: { fontWeight: current === value ? 'bold' : 'normal' }
                }}
              />
            </ListItemButton>
          </ListItem>
        ))}
      </List>
    </WidgetWrapper>
  )
}

export default SideMenu