Rev 2614 | Rev 2960 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |
import React from 'react'import { useNavigate } from 'react-router-dom'import { useSelector } from 'react-redux'import { useFetch } from '@hooks'import Widget from '@app/components/UI/Widget'import List from '@app/components/UI/List'import EmptySection from '@app/components/UI/EmptySection'export default function HomeNews({ currentPost }) {const { data: news } = useFetch('/helpers/posts', [])const labels = useSelector(({ intl }) => intl.labels)const navigate = useNavigate()return (<Widget><Widget.Header title={labels.posts} /><Widget.Body>{news?.length <= 0 ? (<EmptySection message={labels.not_available_posts} />) : null}<List styles={{ maxHeight: '380px', overflow: 'scroll' }}>{news?.map(({ link, title, image, date }) => {if (link.includes(currentPost)) return nullreturn (<List.Itemkey={title}title={title}image={image}subheader={date}avatarVariant='square'onClick={() => navigate(link)}/>)})}</List></Widget.Body></Widget>)}