diff --git a/src/components/Repositories/Repository.jsx b/src/components/Repositories/Repository.jsx index 0b9736ff..b772cae4 100644 --- a/src/components/Repositories/Repository.jsx +++ b/src/components/Repositories/Repository.jsx @@ -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 (
@@ -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}