Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 7110 | | Comparar con el anterior | Ultima modificación | Ver Log |

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