Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 3259 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 3259 Rev 3719
Línea 1... Línea 1...
1
import React from 'react'
1
import React from 'react';
2
import { List as MuiList, ListItem as MuiListItem } from '@mui/material'
2
import { List as MuiList, ListItem as MuiListItem } from '@mui/material';
3
 
3
 
4
import EmptySection from '@components/UI/EmptySection'
4
import EmptySection from '@components/UI/EmptySection';
5
 
5
 
6
export default function List({
6
export default function List({
7
  elementsKey = 'id',
7
  elementsKey = 'id',
8
  items = [],
8
  items = [],
9
  emptyMessage = 'No hay elementos para mostrar',
9
  emptyMessage = 'No hay elementos para mostrar',
10
  renderItem = () => {}
10
  renderItem = () => {}
11
}) {
11
}) {
12
  if (!items.length) {
12
  if (!items.length) {
13
    return <EmptySection message={emptyMessage} />
13
    return <EmptySection message={emptyMessage} />;
14
  }
14
  }
15
 
15
 
16
  return (
16
  return (
17
    <MuiList
17
    <MuiList
18
      sx={{
18
      sx={{
19
        display: 'flex',
19
        display: 'flex',
20
        flexDirection: 'column',
20
        flexDirection: 'column',
21
        gap: ({ spacing }) => spacing(0.5)
21
        gap: ({ spacing }) => spacing(0.5)
22
      }}
22
      }}
23
    >
23
    >
24
      {items.map((item, index) => (
24
      {items.map((item, index) => (
25
        <MuiListItem key={item[elementsKey] ?? index}>
25
        <MuiListItem key={item[elementsKey] ?? index}>{renderItem(item)}</MuiListItem>
26
          {renderItem(item)}
-
 
27
        </MuiListItem>
-
 
28
      ))}
26
      ))}
29
    </MuiList>
27
    </MuiList>
30
  )
28
  );
31
}
29
}