Rev 3890 | AutorÃa | Comparar con el anterior | Ultima modificación | Ver Log |
/* eslint-disable react/prop-types */import React, { useEffect, useState } from 'react'import { axios } from '../../../utils'const PeopleViewedHelper = ({ profileId }) => {const [peopleViewedProfile, setPeopleViewedProfile] = useState([])const [lookMore, setLookMore] = useState(false)useEffect(() => {axios.get(`/helpers/people-viewed-profile/${profileId}`).then(({ data }) => {if (data.success) setPeopleViewedProfile(data.data)})}, [])const getData = () => {let infoFollows = [...peopleViewedProfile]if (!lookMore) {infoFollows = infoFollows.slice(0, 5)}return infoFollows}return (<div className="peopleYouMayKnow"><div className="sd-title d-flex align-items-center justify-content-between"><h3>{`${LABELS.WHO_HAS_SEEN_THIS_PROFILE}:`}</h3>{peopleViewedProfile.length >= 5 &&<span className="cursor-pointer" onClick={() => setLookMore(!lookMore)}>{lookMore ? LABELS.VIEW_LESS : LABELS.VIEW_MORE}</span>}</div><div className="suggest-list">{peopleViewedProfile.length? getData().map(({ id, name, image, profile }) =><div className='user' key={id}><aclassName="w-100 d-flex align-items-center"href={profile}target="_blank"rel="noreferrer"style={{ gap: '.5rem' }}><img src={image} alt={`${name} profile image`} /><h4>{name}</h4></a></div>): <div className="view-more">{LABELS.PROFILE_NOT_VIEWED}</div>}</div></div>)}export default PeopleViewedHelper