Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
4313 stevensc 1
/* eslint-disable react/prop-types */
2
import React, { useEffect } from 'react'
3
import ExpandMoreIcon from '@mui/icons-material/ExpandMore'
4
import GroupIcon from '@mui/icons-material/Group'
5
import { useState } from 'react'
6
import axios from '../../../../utils/axios'
7
 
8
const HelpersContainer = (props) => {
9
  const [recentItem1, setrecentItem1] = useState(false)
10
  const [recentItem2, setrecentItem2] = useState(false)
11
 
12
  return (
13
    <div className='sidebar__bottom'>
14
      <HelpersContainer.Item />
15
    </div>
16
  )
17
}
18
 
19
const Item = ({ url = '/helpers/my-groups', title = 'Mis grupos' }) => {
20
 
21
  const [widgetData, setWidgetData] = useState([]);
22
  const [lookMore, setLookMore] = useState(false);
23
 
24
  const getData = () => {
25
    axios.get(url)
26
      .then(({ data: response }) => {
27
        const { success, data } = response
28
        if (success) {
29
          setWidgetData(data.sort((a, b) => a.priority - b.priority).reverse());
30
        }
31
      });
32
  }
33
 
34
  useEffect(() => {
35
    getData()
36
  }, []);
37
 
38
  const dataSlice = () => {
39
    let infoFollows = [...widgetData]
40
    if (!lookMore) {
41
      infoFollows = infoFollows.slice(0, 1)
42
    }
43
    return infoFollows
44
  }
45
 
46
  return (
47
    <div className='sidebar__recent-item__container'>
48
 
49
      <section className='sidebar__recent-item'>
50
        <p>{title}</p>
51
 
52
        <div className='sidebar__recent-actions'>
53
          <button className='sidebar__recent-icon'>
54
            <ExpandMoreIcon />
55
          </button>
56
        </div>
57
 
58
 
59
        <ul className=''>
60
          <li className=''>
61
            <a className=''
62
              href=''
63
            >
64
              <div className=''>
65
                <GroupIcon />
66
                <span>React Native</span>
67
              </div>
68
            </a>
69
          </li>
70
        </ul>
71
      </section>
72
 
73
    </div>
74
  )
75
}
76
 
77
HelpersContainer.Item = Item
78
 
79
export default HelpersContainer