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