Proyectos de Subversion LeadersLinked - SPA

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
3481 stevensc 1
import React from 'react';
2
import { useNavigate } from 'react-router-dom';
3
import { Box, styled, Typography } from '@mui/material';
4
 
5
import { parse } from '@utils';
6
 
7
import CapsuleButton from './CapsuleButton';
8
 
9
const StyledCapsuleContainer = styled(Box)`
10
  border-radius: 6px;
11
  background: var(--font-color);
12
  box-shadow: 0px 0px 15px 0px rgba(0, 0, 0, 0.14);
13
  padding: 16px;
14
  display: flex;
15
  align-items: center;
16
  gap: 1rem;
17
  p {
18
    color: #fff;
19
    font-family: 'Roboto Condensed', 'Roboto';
20
    font-size: 14px;
21
    font-weight: 400;
22
    line-height: normal;
23
    margin-bottom: 8px;
24
  }
25
  h3 {
26
    color: var(--subtitle-color);
27
  }
28
`;
29
 
30
const StyledDetails = styled('div')`
31
  display: block;
32
  flex: 1;
33
`;
34
 
35
const StyledImage = styled('picture')`
36
  border-radius: 6px;
37
  overflow: hidden;
38
  max-width: 100px;
39
  aspect-ratio: 1/1.5;
40
  background-color: var(--bg-color-secondary);
41
  img {
42
    width: 100%;
43
    height: 100%;
44
    object-fit: cover;
45
  }
46
`;
47
 
48
const StyledTag = styled('div')`
49
  font-size: 12px;
50
  font-weight: 700;
51
  text-transform: uppercase;
52
  padding: 5px 10px;
53
  color: #fff;
54
  border-radius: 5px;
55
`;
56
 
57
export function CapsuleCard({ capsule: { name, description, image, completed, uuid }, ...rest }) {
58
  const navigate = useNavigate();
59
 
60
  return (
61
    <StyledCapsuleContainer {...rest}>
62
      <StyledDetails active>
63
        <StyledTag>{completed ? 'Completa' : 'En curso'}</StyledTag>
64
 
65
        <Typography variant='h3' mt={2}>
66
          {name}
67
        </Typography>
68
 
69
        {parse(description)}
70
 
71
        <CapsuleButton
72
          label='Ver cápsula'
73
          onClick={() => navigate(`/microlearning/capsules/${uuid}/slides`)}
74
        />
75
      </StyledDetails>
76
 
77
      <StyledImage>
78
        <img src={image} alt={name} />
79
      </StyledImage>
80
    </StyledCapsuleContainer>
81
  );
82
}