Skip to content

Commit

Permalink
Fixing publication date
Browse files Browse the repository at this point in the history
  • Loading branch information
viktor-yakubiv committed Jan 28, 2021
1 parent 1025922 commit 3c8dca6
Showing 1 changed file with 35 additions and 23 deletions.
58 changes: 35 additions & 23 deletions templates/data-provider/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import styles from './styles.module.css'
import Pagination from './pagination'

import Search from 'modules/search-layout'
import formatDate from 'utils/format-date'

// TODO: Look for polyfill
const countryName =
Expand Down Expand Up @@ -42,30 +43,41 @@ const DataProviderTemplate = ({
className={styles.search}
placeholder={`Search research outputs in ${data.name}`}
/>
{outputs.map(({ id, abstract, title, authors, year, links }) => {
const fullTextLink = links.find((l) => l.type === 'download')?.url
const metadataLink = links.find((l) => l.type === 'display')?.url
{outputs.map(
({
id,
abstract,
title,
authors,
publishedDate: publicationDate,
links,
}) => {
const fullTextLink = links.find((l) => l.type === 'download')?.url
const metadataLink = links.find((l) => l.type === 'display')?.url

return (
<SearchResult
key={id}
id={id}
className={styles.resultItem}
tag={Search.Result}
data={{
title,
author: authors,
publicationDate: String(year),
thumbnailUrl: `//core.ac.uk/image/${id}/medium`,
metadataLink,
fullTextLink,
}}
aria-busy={loading}
>
{abstract}
</SearchResult>
)
})}
return (
<SearchResult
key={id}
id={id}
className={styles.resultItem}
tag={Search.Result}
data={{
title,
author: authors,
publicationDate: publicationDate
? formatDate(new Date(publicationDate))
: null,
thumbnailUrl: `//core.ac.uk/image/${id}/medium`,
metadataLink,
fullTextLink,
}}
aria-busy={loading}
>
{abstract}
</SearchResult>
)
}
)}
{outputs.length === 0 && (
<div className={styles.noResultsFind}>No results found</div>
)}
Expand Down

0 comments on commit 3c8dca6

Please sign in to comment.