Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 4315 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 4315 Rev 4316
Línea 1... Línea 1...
1
/* eslint-disable react/prop-types */
1
/* eslint-disable react/prop-types */
2
import React, { useEffect } from 'react'
2
import React, { useEffect, useState } from 'react'
-
 
3
import axios from '../../../../utils/axios'
3
import ExpandMoreIcon from '@mui/icons-material/ExpandMore'
4
import ExpandMoreIcon from '@mui/icons-material/ExpandMore'
4
import GroupIcon from '@mui/icons-material/Group'
5
import GroupIcon from '@mui/icons-material/Group'
5
import { useState } from 'react'
-
 
6
import axios from '../../../../utils/axios'
-
 
7
import EmptySection from '../../../../shared/empty-section/EmptySection'
6
import EmptySection from '../../../../shared/empty-section/EmptySection'
Línea 8... Línea 7...
8
 
7
 
9
const HelpersContainer = (props) => {
-
 
10
  const [recentItem1, setrecentItem1] = useState(false)
-
 
Línea 11... Línea 8...
11
  const [recentItem2, setrecentItem2] = useState(false)
8
const HelpersContainer = () => {
12
 
9
 
13
  return (
10
  return (
14
    <div className='sidebar__bottom'>
11
    <div className='sidebar__bottom'>
Línea 25... Línea 22...
25
  const getData = () => {
22
  const getData = () => {
26
    axios.get(url)
23
    axios.get(url)
27
      .then(({ data: response }) => {
24
      .then(({ data: response }) => {
28
        const { success, data } = response
25
        const { success, data } = response
29
        if (success) {
26
        if (success) {
30
          setWidgetData(data.sort((a, b) => a.priority - b.priority).reverse());
27
          setWidgetData(data.slice(0, 3).sort((a, b) => a.priority - b.priority).reverse());
31
        }
28
        }
32
      });
29
      });
33
  }
30
  }
Línea 34... Línea 31...
34
 
31
 
35
  useEffect(() => {
32
  useEffect(() => {
36
    getData()
33
    getData()
Línea 37... Línea -...
37
  }, []);
-
 
38
 
-
 
39
  const dataSlice = () => {
-
 
40
    let infoFollows = [...widgetData]
-
 
41
    if (!lookMore) {
-
 
42
      infoFollows = infoFollows.slice(0, 3)
-
 
43
    }
-
 
44
    return infoFollows
-
 
45
  }
34
  }, []);
46
 
35
 
Línea 47... Línea 36...
47
  return (
36
  return (
48
    <div className='sidebar__recent-item__container'>
37
    <div className='sidebar__recent-item__container'>
Línea 56... Línea 45...
56
        </div>
45
        </div>
57
      </section>
46
      </section>
Línea 58... Línea 47...
58
 
47
 
59
      <ul className={`helper__list ${lookMore ? 'show' : 'hide'}`}>
48
      <ul className={`helper__list ${lookMore ? 'show' : 'hide'}`}>
60
        {widgetData.length
49
        {widgetData.length
61
          ? dataSlice().map(({ id, name, profile }) =>
50
          ? widgetData.map(({ id, name, profile }) =>
62
            <li key={id}>
51
            <li key={id}>
63
              <a href={profile} className='helper__list-itemf'>
52
              <a href={profile} className='helper__list-item'>
64
                <GroupIcon />
53
                <GroupIcon />
65
                <span>{name}</span>
54
                <span>{name}</span>
66
              </a>
55
              </a>
67
            </li>
56
            </li>