1
0
mirror of https://github.com/oceanprotocol/docs.git synced 2024-06-30 05:31:57 +02:00

Merge pull request #49 from oceanprotocol/fix/48

output additional links on all repos
This commit is contained in:
Matthias Kretschmann 2018-11-20 23:27:36 +01:00 committed by GitHub
commit fa04cfb9d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 22 deletions

View File

@ -27,7 +27,7 @@
- [Repositories](#repositories)
- [Development](#development)
- [Using npm](#using-npm)
- [Using Docker](#use-docker)
- [Using Docker](#using-docker)
- [Linting & Formatting](#linting--formatting)
- [Editor Setup: VS Code](#editor-setup-vs-code)
- [GitHub GraphQL API](#github-graphql-api)
@ -166,7 +166,7 @@ Additionally, you can attach multiple links to a repo. The GitHub link is automa
url: https://github.com/oceanprotocol/keeper-contracts/tree/develop/doc
```
in [`/data/repositories.yml`](data/repositories.yml).
in [`/data/repositories.yml`](data/repositories.yml). The links defined in this file will also be used to enhance the display of the repository component on all other pages.
## Development

View File

@ -5,24 +5,6 @@ description: On this site, Markdown is transformed to HTML through Remark follow
For more complete info, see [John Gruber's original spec](http://daringfireball.net/projects/markdown/) and the [Github-flavored Markdown info page](http://github.github.com/github-flavored-markdown/).
## Table of Contents
- [Headers](#header)
- [Emphasis](#emphasis)
- [Lists](#lists)
- [Links](#links)
- [Images](#images)
- [Code and Syntax Highlighting](#code-and-syntax-highlighting)
- [Tables](#tables)
- [Blockquotes](#blockquotes)
- [Inline HTML](#inline-html)
- [Horizontal Rule](#horizontal-rule)
- [Line Breaks](#line-breaks)
- [Videos](#videos)
- [React Components in Markdown](#react-components-in-markdown)
- [Repository Component](#repository-component)
- [Embedding File Contents from GitHub](#embedding-file-contents-from-github)
## Headers
```text
@ -347,7 +329,7 @@ Or, in pure Markdown, but losing the image sizing and border:
[![IMAGE ALT TEXT HERE](http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg)](http://www.youtube.com/watch?v=YOUTUBE_VIDEO_ID_HERE)
```
### Repository Component
## GitHub Repository Component
In all Markdown docs you can use some select React Components. This magic is done with [gatsby-remark-component](https://www.gatsbyjs.org/packages/gatsby-remark-component/).

View File

@ -44,6 +44,20 @@ const queryGithub = graphql`
}
}
}
allRepositoriesYaml {
edges {
node {
items {
name
links {
name
url
}
}
}
}
}
}
`
@ -129,6 +143,7 @@ const Repository = ({ name, links, readme }) => (
render={data => {
const repositoriesGitHub =
data.github.organization.repositories.edges
const repositoriesYaml = data.allRepositoriesYaml.edges
// just iterate over all repos until we have a name match,
// then return that repo, and then filter out all empty nodes
@ -153,6 +168,20 @@ const Repository = ({ name, links, readme }) => (
object
} = repo
// enhance passed links array with what's in repositories.yml,
// iterating over all repos until we have a name match
const linksFilteredArray = repositoriesYaml.map(({ node }) => {
return node.items
.map(item => {
if (item.name === name) {
return item.links
}
})
.filter(n => n)[0]
})
const moreLinks = links || linksFilteredArray[0]
return (
<article className={styles.repository}>
<Title name={name} releases={releases} url={url} />
@ -160,7 +189,7 @@ const Repository = ({ name, links, readme }) => (
<p>{!description ? '...' : description}</p>
<footer className={styles.repositoryMeta}>
<Links links={links} url={url} />
<Links links={moreLinks} url={url} />
<Numbers
stargazers={stargazers}
forkCount={forkCount}