-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Improves the store, data and pages infrastructure: 1.1. Moves validation to `utils` 1.2. Renames `repository-map` to `map` 2. Improves general layout to fit the data provider page layout. 3. Adds data-provider template for the individual data provider details page. The template includes: 3.1. Pagination – brand new. 3.2. Map card, improved from the existing component 3.3. Claiming card (disabled at the moment) 4. Adds an API module for the data provider data fetching. The API module's kept quite simple and based on the new APIv3. 5. Upgrades @oacore/design to 'latest', flags the tag explicitly in the package.json so the library is always up to date.
- Loading branch information
1 parent
6ed52fb
commit 3b70e9a
Showing
32 changed files
with
1,058 additions
and
376 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import request from './index' | ||
|
||
// TODO: Move this to appropriate place when the APIv3 is ready | ||
const API_V3_URL = process.env.API_URL.replace('/internal', '/v3') | ||
|
||
const apiRequest = (url, ...args) => request(`${API_V3_URL}${url}`, ...args) | ||
|
||
const fetchMetadata = async (id) => { | ||
const { data } = await apiRequest(`/data-providers/${id}`) | ||
return data | ||
} | ||
|
||
const fetchOutputs = async (id, searchParams) => { | ||
const { data } = await apiRequest(`/data-providers/${id}/outputs`, { | ||
searchParams, | ||
}) | ||
return data | ||
} | ||
|
||
export { fetchMetadata, fetchOutputs } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import React, { useState } from 'react' | ||
import { Button, Link } from '@oacore/design' | ||
import { classNames } from '@oacore/design/lib/utils' | ||
|
||
import styles from './styles.module.css' | ||
|
||
const AuthorLink = ({ name }) => ( | ||
<Link | ||
href={`https://core.ac.uk/search?q=author:(${name})`} | ||
className={styles.authorLink} | ||
> | ||
{name.replace(',', ' ')} | ||
</Link> | ||
) | ||
|
||
const Authors = ({ authors }) => { | ||
const [isExpanded, setIsExpanded] = useState(false) | ||
if (authors.length <= 3) { | ||
return authors.map((author, index) => ( | ||
<> | ||
<AuthorLink name={author.name} /> | ||
{index < authors.length - 1 ? ', ' : ''} | ||
</> | ||
)) | ||
} | ||
|
||
return ( | ||
<> | ||
<AuthorLink name={authors[0].name} />,{' '} | ||
<AuthorLink name={authors[1].name} />,{' '} | ||
<span | ||
className={classNames.use( | ||
styles.moreAuthorsBox, | ||
isExpanded && styles.moreAuthorsExpanded | ||
)} | ||
> | ||
<Button | ||
className={styles.showMore} | ||
aria-controls="more-authors" | ||
onClick={() => setIsExpanded(true)} | ||
aria-hidden={isExpanded} | ||
title="Show more authors" | ||
> | ||
+ {authors.length - 3} MORE | ||
</Button> | ||
<span | ||
id="more-authors" | ||
aria-hidden={!isExpanded} | ||
className={styles.moreAuthors} | ||
> | ||
{authors.slice(2, -1).map((author) => ( | ||
<> | ||
<AuthorLink name={author.name} />,{' '} | ||
</> | ||
))} | ||
</span> | ||
</span> | ||
<AuthorLink name={authors[authors.length - 1].name} /> | ||
</> | ||
) | ||
} | ||
|
||
export default Authors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
.author-link { | ||
color: var(--gray-800); | ||
text-decoration: underline; | ||
} | ||
|
||
.show-more { | ||
position: relative; | ||
padding: 0 0.25rem; | ||
margin: 0 0.25rem; | ||
color: var(--gray-700); | ||
text-transform: uppercase; | ||
white-space: nowrap; | ||
background: var(--gray-100); | ||
} | ||
|
||
.show-more::after { | ||
position: absolute; | ||
right: -0.05rem; | ||
content: ','; | ||
} | ||
|
||
.more-authors { | ||
display: none; | ||
} | ||
|
||
.more-authors-box { | ||
display: contents; | ||
} | ||
|
||
.more-authors-expanded .show-more { | ||
display: none; | ||
} | ||
|
||
.more-authors-expanded .more-authors { | ||
display: inline-block; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import Content from './content' | ||
import Sidebar from './sidebar' | ||
import Result from './result' | ||
import Results from './results' | ||
import Main from './main' | ||
import Search from './search' | ||
import ResultStats from './result-stats' | ||
|
||
Search.Content = Content | ||
Search.Sidebar = Sidebar | ||
Search.Result = Result | ||
Search.Results = Results | ||
Search.Main = Main | ||
Search.ResultStats = ResultStats | ||
|
||
export default Search |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from 'react' | ||
import { classNames } from '@oacore/design/lib/utils' | ||
|
||
import styles from './styles.module.css' | ||
|
||
const Main = ({ children, className, tag: Tag = 'div', ...restProps }) => ( | ||
<Tag className={classNames.use(styles.main, className)} {...restProps}> | ||
{children} | ||
</Tag> | ||
) | ||
|
||
export default Main |
Oops, something went wrong.