Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 2393 | Rev 2605 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 2393 Rev 2562
Línea 90... Línea 90...
90
export function WidgetMedia({
90
export function WidgetMedia({
91
  src = '',
91
  src = '',
92
  height = 200,
92
  height = 200,
93
  width = 200,
93
  width = 200,
94
  alt = '',
94
  alt = '',
95
  component = 'img',
95
  type = 'image',
96
  styles = {},
96
  styles = {},
97
  ...props
97
  ...props
98
}) {
98
}) {
-
 
99
  const getMediaComponent = (type) => {
-
 
100
    const options = {
-
 
101
      image: 'img',
-
 
102
      video: 'video',
-
 
103
      audio: 'audio'
-
 
104
    }
-
 
105
 
-
 
106
    return options[type] ?? options.image
-
 
107
  }
-
 
108
 
99
  return (
109
  return (
100
    <CardMedia
110
    <CardMedia
101
      alt={alt}
111
      alt={alt}
102
      component={component}
112
      component={getMediaComponent(type)}
103
      height={height}
113
      height={height}
104
      image={src}
114
      src={src}
105
      width={width}
115
      width={width}
106
      sx={{
116
      sx={{
107
        objectFit: 'contain',
117
        objectFit: 'contain',
108
        ...styles
118
        ...styles
109
      }}
119
      }}