Proyectos de Subversion LeadersLinked - SPA

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
5 stevensc 1
import React from 'react'
2
import { Avatar } from '@mui/material'
3
import { useSelector } from 'react-redux'
4
import parse from 'html-react-parser'
517 stevensc 5
import { Link } from 'react-router-dom'
5 stevensc 6
 
7
const UserInfo = ({
8
  cover = '',
9
  image = '',
10
  fullname = '',
11
  description = '',
12
  visits = 0,
13
  connections = 0,
14
}) => {
15
  const labels = useSelector(({ intl }) => intl.labels)
16
  return (
17
    <div className="sidebar__top">
18
      {cover && (
19
        <img
20
          src="./static/profile_2.jpg"
21
          alt="Profile cover"
22
          className="sidebar__cover"
23
        />
24
      )}
25
      <Avatar
26
        src={image}
27
        alt={`${fullname} profile image`}
28
        sx={{ width: '60px', height: '60px' }}
29
      />
30
      <h2>{parse(fullname)}</h2>
31
      {parse(description)}
32
      <StatItem
33
        title={labels.who_has_seen_my_profile}
34
        number={visits}
35
        url="/profile/people-viewed-profile"
36
      />
37
      <StatItem
38
        title={labels.connections}
39
        number={connections}
40
        url="/connection/my-connections"
41
      />
42
    </div>
43
  )
44
}
45
 
46
const StatItem = ({ title = '', number = 0, url = '' }) => {
47
  return (
517 stevensc 48
    <Link
49
      to={url}
5 stevensc 50
      className="sidebar__stat"
51
      target="secondary"
52
      onClick={(e) => !url && e.preventDefault()}
53
    >
54
      <span>{title}</span>
55
      <span className="sidebar__stat-number">{number}</span>
517 stevensc 56
    </Link>
5 stevensc 57
  )
58
}
59
 
60
export default UserInfo