Rev 2277 | Rev 2279 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |
import React from 'react'import { useHistory } from 'react-router-dom'import { useSelector } from 'react-redux'import useFetch from '@app/hooks/useFetch'import Widget from '@app/components/UI/Widget'import EmptySection from '@app/components/UI/EmptySection'import { List, ListItem } from '@app/components/UI/List'export default function HomeNews({ currentPost }) {const { data: news } = useFetch('/helpers/posts')const labels = useSelector(({ intl }) => intl.labels)const history = useHistory()return (<Widget><Widget.Header title={labels.posts} /><Widget.Body><EmptySection message={labels.not_available_posts} /><List>{news.map(({ link, title, image, date }) => {if (link.includes(currentPost)) return nullreturn (<ListItemkey={title}title={title}image={image}subheader={date}avatarVariant='square'onClick={() => history.replace(link)}/>)})}</List></Widget.Body></Widget>)}