Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 3481 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 3481 Rev 3527
Línea 1... Línea 1...
1
import React from 'react'
1
import React from 'react';
2
import { useSelector } from 'react-redux'
-
 
3
import { Link } from 'react-router-dom'
-
 
4
import { Typography } from '@mui/material'
-
 
5
 
-
 
6
import { useMicroLearning, useFetch } from '@hooks'
2
import { Card, CardHeader, CardMedia } from '@shared/components';
7
 
-
 
8
import { TopicContainer, TopicsGrid } from './UI'
-
 
9
import Spinner from '@components/UI/Spinner'
-
 
10
import EmptySection from '@components/UI/EmptySection'
-
 
11
 
-
 
12
const Companies = () => {
-
 
13
  const { link_companies: linkCompanies } = useMicroLearning()
-
 
14
  const { data: companies, isLoading } = useFetch(linkCompanies, [])
-
 
15
  const labels = useSelector(({ intl }) => intl.labels)
-
 
16
 
-
 
17
  if (isLoading) {
-
 
18
    return <Spinner />
-
 
19
  }
-
 
Línea -... Línea 3...
-
 
3
 
20
 
4
export function CompanyItem({ company: { name, image } }) {
21
  return (
5
  return (
22
    <TopicsGrid>
-
 
23
      {companies.length ? (
6
    <Card>
24
        companies.map((company) => (
7
      <CardHeader title={name} />
25
          <Company key={company.uuid} company={company} />
-
 
26
        ))
-
 
27
      ) : (
-
 
28
        <EmptySection message={labels.datatable_szerorecords} />
-
 
29
      )}
8
      <CardMedia src={image} alt={name} />
30
    </TopicsGrid>
9
    </Card>
31
  )
10
  );
32
}
-
 
33
 
-
 
34
const Company = ({ company }) => {
-
 
35
  const { name, image, uuid } = company
-
 
36
 
-
 
37
  return (
-
 
38
    <Link to={uuid}>
-
 
39
      <TopicContainer>
-
 
40
        <div className='c-header'>
-
 
41
          <Typography variant='h3'>{name}</Typography>
-
 
42
        </div>
-
 
43
        <div className='c-body'>
-
 
44
          <img src={image} alt='' />
-
 
45
        </div>
-
 
46
      </TopicContainer>
-
 
47
    </Link>
-
 
48
  )
-
 
49
}
-
 
50
 
-