Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Ir a la última revisión | | Ultima modificación | Ver Log |

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