Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev Autor Línea Nro. Línea
4538 stevensc 1
/* eslint-disable react/prop-types */
6862 stevensc 2
import React, { useEffect, useState } from 'react'
3
import { axios } from '../../../../../utils'
4
import EastIcon from '@mui/icons-material/East'
4538 stevensc 5
import MembersModal from '../../../../../shared/helpers/group-members-helper/MembersModal'
6
import Avatar from '../../../../../shared/Avatar/Avatar'
7
 
8
const CompanyFollowers = ({ companyId }) => {
6862 stevensc 9
  const [followers, setFollowers] = useState([])
10
  const [showMembersModal, setShowMembersModal] = useState(false)
4538 stevensc 11
 
6862 stevensc 12
  useEffect(() => {
13
    axios.get(`/helpers/company-follower/${companyId}`).then(({ data }) => {
14
      if (data.success) setFollowers(data.data)
15
    })
16
  }, [])
4538 stevensc 17
 
6862 stevensc 18
  const openModal = (e) => {
19
    e.preventDefault()
20
    setShowMembersModal(true)
21
  }
4538 stevensc 22
 
6862 stevensc 23
  return (
24
    <>
25
      <MembersModal
26
        isShow={showMembersModal}
27
        handleClose={() => setShowMembersModal(!showMembersModal)}
28
        members={followers}
29
        handleAction={() => null}
30
      />
31
      <div className="suggest__widget">
32
        <div className="linked__widget-header">
33
          <h3>{followers.length} Seguidores</h3>
34
        </div>
35
        <div className="members-image__list">
36
          {followers.slice(0, 4).map((member) => {
37
            return (
38
              <Avatar
39
                key={member.name}
40
                imageUrl={member.image}
41
                size="lg"
42
                name={member.name}
43
              />
44
            )
45
          })}
46
        </div>
47
        <a className="load__suggest" onClick={(e) => openModal(e)}>
48
          <span>Ver más</span>
49
          <EastIcon />
50
        </a>
51
      </div>
52
    </>
53
  )
54
}
4538 stevensc 55
 
56
export default CompanyFollowers