Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 3694 | | 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 { Typography } from '@mui/material';
3
import CheckCircle from '@mui/icons-material/CheckCircle';
4
 
5
import { parse } from '@shared/utils';
6
import { CardMedia } from '@shared/components';
7
import { SlideQuiz } from './slide-quiz';
8
 
9
export function SlideCard({
10
  slide: { type, file, description, name, quiz_data, link_take_a_test },
11
  completed,
12
  autoPlay = false,
13
  onComplete
14
}) {
15
  return (
16
    <>
17
      {!!completed && (
18
        <CheckCircle sx={{ position: 'absolute', top: '1rem', right: '1rem' }} color='success' />
19
      )}
20
      {type === 'quiz' && (
21
        <SlideQuiz
22
          quiz={quiz_data ? quiz_data[0] : {}}
23
          startUrl={link_take_a_test}
24
          slide={{ type, file, description, name, quiz_data, link_take_a_test }}
25
          onSync={onComplete}
26
          completed={completed}
27
        />
28
      )}
29
      {type === 'text' && <Typography>{parse(description)}</Typography>}
30
      {type === 'image' && (
31
        <CardMedia
32
          styles={{ width: '100%', height: '100%', objectFit: 'contain' }}
33
          src={file}
34
          alt={name}
35
          type='image'
36
        />
37
      )}
38
      {type === 'video' && (
39
        <CardMedia
40
          styles={{ width: '100%', height: '100%', objectFit: 'contain' }}
41
          src={file}
42
          alt={name}
43
          type='video'
44
          autoPlay={autoPlay}
45
          controls
46
          controlsList='nodownload'
47
          onEnded={onComplete}
48
        />
49
      )}
50
      {/*  {type === 'audio' && <CardMedia src={file} alt={name} type='audio' />}
51
        {type === 'document' && <CardMedia src={file} alt={name} type='document' />} */}
52
    </>
53
  );
54
}