Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 3596 | | 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 { useNavigate } from 'react-router-dom';
3
import { Avatar, Button, styled, Typography } from '@mui/material';
4
import { useSelector } from 'react-redux';
5
import parse from 'html-react-parser';
6
 
7
import Widget from '@components/UI/Widget';
8
 
9
const WidgetButton = styled(Button)(() => ({
10
  borderRadius: 0,
11
  display: 'flex',
12
  justifyContent: 'space-between',
13
  width: '100%',
14
  '& span': {
15
    color: '#0a66c2'
16
  }
17
}));
18
 
19
const UserProfileAvatar = styled(Avatar)(() => ({
20
  width: '60px',
21
  height: '60px',
22
  margin: 'auto'
23
}));
24
 
25
const UserProfileCard = ({
26
  user: { cover = '', image = '', fullname = '', description = '', visits = 0, connections = 0 }
27
}) => {
28
  const labels = useSelector(({ intl }) => intl.labels);
29
  const navigate = useNavigate();
30
 
31
  const handleNavigate = (path) => navigate(path);
32
 
33
  return (
34
    <Widget>
35
      <Widget.Media
36
        src={cover}
37
        alt={`${fullname} profile cover`}
38
        height={60}
39
        styles={{
40
          display: cover ? 'block' : 'none',
41
          marginBottom: cover ? '-20px' : '0px'
42
        }}
43
      />
44
 
45
      <Widget.Body styles={{ textAlign: 'center' }}>
46
        <UserProfileAvatar src={image} alt={`${fullname} profile image`} />
47
        <Typography variant='h2'>{fullname}</Typography>
48
        {parse(description ?? '')}
49
      </Widget.Body>
50
 
51
      <WidgetButton onClick={() => handleNavigate('/profile/people-viewed-profile')}>
52
        {labels.who_has_seen_my_profile}
53
        <Typography variant='overline'>{visits ?? 0}</Typography>
54
      </WidgetButton>
55
 
56
      <WidgetButton onClick={() => handleNavigate('/connection/my-connections')}>
57
        {labels.connections}
58
        <Typography variant='overline'>{connections ?? 0}</Typography>
59
      </WidgetButton>
60
    </Widget>
61
  );
62
};
63
 
64
export default UserProfileCard;