Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 3569 Rev 3719
Línea 1... Línea 1...
1
import React from 'react';
1
import React from 'react';
2
import { CardMedia as MuiCardMedia } from '@mui/material';
2
import { CardMedia as MuiCardMedia } from '@mui/material';
3
 
3
 
4
const MEDIA_TYPES = {
4
const MEDIA_TYPES = {
5
  image: 'img',
5
  image: 'img',
6
  video: 'video',
6
  video: 'video',
7
  audio: 'audio',
7
  audio: 'audio',
8
  document: 'a'
8
  document: 'a'
9
};
9
};
10
 
10
 
11
export function CardMedia({
11
export function CardMedia({
12
  src = '',
12
  src = '',
13
  height,
13
  height,
14
  width,
14
  width,
15
  alt = '',
15
  alt = '',
16
  type = 'image',
16
  type = 'image',
17
  styles = {
17
  styles = {
18
    objectFit: 'contain'
18
    objectFit: 'contain'
19
  },
19
  },
20
  ...props
20
  ...props
21
}) {
21
}) {
22
  return (
22
  return (
23
    <MuiCardMedia
23
    <MuiCardMedia
24
      image={src}
24
      image={src}
25
      alt={alt}
25
      alt={alt}
26
      width={width}
26
      width={width}
27
      height={height}
27
      height={height}
28
      sx={styles}
28
      sx={styles}
29
      component={MEDIA_TYPES[type] ?? MEDIA_TYPES.image}
29
      component={MEDIA_TYPES[type] ?? MEDIA_TYPES.image}
30
      {...props}
30
      {...props}
31
    />
31
    />
32
  );
32
  );
33
}
33
}