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 { Link } from 'react-router-dom';
3
import { styled } from '@mui/material';
4
 
5
import { parse } from '@utils';
6
 
7
import { CapsuleRating } from './UI';
8
 
9
const StyledCapsule = styled('article')`
10
  display: flex;
11
  border-bottom: 1px solid var(--border-primary);
12
  gap: 1rem;
13
  padding: 0.5rem;
14
  align-items: center;
15
  width: 100%;
16
  picture {
17
    width: 60px;
18
    height: 100px;
19
    img {
20
      width: 100%;
21
      height: 100%;
22
      object-fit: contain;
23
    }
24
  }
25
`;
26
 
27
const StyledCapsuleDescription = styled('div')`
28
  display: flex;
29
  flex-direction: column;
30
  flex: 1 1 50%;
31
  overflow: hidden;
32
`;
33
 
34
export const CapsuleItem = ({
35
  capsule: { name, description, image, total_rating, uuid },
36
  readOnly = false
37
}) => {
38
  return (
39
    <Link to={`/microlearning/capsules/${uuid}`}>
40
      <StyledCapsule>
41
        <picture>
42
          <img src={image} alt={`${name} capsule image`} />
43
        </picture>
44
 
45
        <StyledCapsuleDescription>
46
          <h2>{name}</h2>
47
          {parse(description)}
48
          <CapsuleRating
49
            readOnly={readOnly}
50
            defaultValue={Number(total_rating)}
51
            size='small'
52
            sx={{ mt: 1 }}
53
          />
54
        </StyledCapsuleDescription>
55
      </StyledCapsule>
56
    </Link>
57
  );
58
};