Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 2641 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
3719 stevensc 1
import React from 'react';
2
import { List, ListItem, ListItemButton, ListItemText, Typography } from '@mui/material';
3
 
4
import Widget from '../Widget';
5
 
6
const SideMenu = ({
7
  items = [],
8
  onChange = null,
9
  title = '',
10
  current = '',
11
  defaultValue = '',
12
  defaultLabel = ''
13
}) => {
14
  const handleChange = (value) => onChange(value);
15
 
16
  return (
17
    <Widget>
18
      <Widget.Body>
19
        <Typography variant='h2'>{title}</Typography>
20
 
21
        <List sx={{ mt: 1 }}>
22
          <ListItemButton
23
            sx={{ py: 0, display: defaultLabel ? 'initial' : 'none' }}
24
            onClick={() => handleChange(defaultValue)}
25
          >
26
            <ListItemText
27
              primary={defaultLabel}
28
              slotProps={{
29
                primary: {
30
                  sx: { fontWeight: current === defaultValue ? 'bold' : 'normal' }
31
                }
32
              }}
33
            />
34
          </ListItemButton>
35
          {items.map(({ value, label }) => (
36
            <ListItem key={value} sx={{ p: 0 }}>
37
              <ListItemButton sx={{ py: 0 }} onClick={() => handleChange(value)}>
38
                <ListItemText id={value} primary={label} />
39
              </ListItemButton>
40
            </ListItem>
41
          ))}
42
        </List>
43
      </Widget.Body>
44
    </Widget>
45
  );
46
};
47
 
48
export default SideMenu;