1
0
mirror of https://github.com/oceanprotocol/docs.git synced 2024-11-26 19:49:26 +01:00

label forks

This commit is contained in:
Matthias Kretschmann 2019-06-07 14:23:58 +02:00
parent 71eee0a2e0
commit 5502ba86ad
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 45 additions and 3 deletions

View File

@ -19,6 +19,10 @@ const queryGithub = graphql`
description description
url url
forkCount forkCount
isFork
parent {
nameWithOwner
}
stargazers { stargazers {
totalCount totalCount
} }
@ -62,9 +66,15 @@ const queryGithub = graphql`
} }
` `
const Title = ({ name, releases, url }) => ( const Title = ({ name, isFork, parent, releases, url }) => (
<h1 className={styles.repositoryName}> <h1 className={styles.repositoryName}>
<a href={url}>{name}</a> <a href={url}>
{isFork && <Forks />}
{name}
{isFork && (
<span className={styles.forkLine}>{parent.nameWithOwner}</span>
)}
</a>
{releases.edges[0] && ( {releases.edges[0] && (
<a <a
href={`${url}/releases`} href={`${url}/releases`}
@ -79,6 +89,10 @@ const Title = ({ name, releases, url }) => (
Title.propTypes = { Title.propTypes = {
name: PropTypes.string.isRequired, name: PropTypes.string.isRequired,
isFork: PropTypes.bool,
parent: PropTypes.shape({
nameWithOwner: PropTypes.string
}),
releases: PropTypes.object.isRequired, releases: PropTypes.object.isRequired,
url: PropTypes.string.isRequired url: PropTypes.string.isRequired
} }
@ -226,6 +240,8 @@ const Repository = ({ name, links, readme }) => (
url, url,
description, description,
forkCount, forkCount,
isFork,
parent,
stargazers, stargazers,
releases, releases,
object object
@ -247,7 +263,13 @@ const Repository = ({ name, links, readme }) => (
return ( return (
<article className={styles.repository}> <article className={styles.repository}>
<Title name={name} releases={releases} url={url} /> <Title
name={name}
releases={releases}
url={url}
isFork={isFork}
parent={parent}
/>
<p>{!description ? '...' : description}</p> <p>{!description ? '...' : description}</p>

View File

@ -24,6 +24,7 @@
border: 0; border: 0;
padding: 0; padding: 0;
width: 100%; width: 100%;
position: relative;
a:first-of-type { a:first-of-type {
color: $brand-black; color: $brand-black;
@ -33,6 +34,25 @@
color: $brand-pink; color: $brand-pink;
} }
} }
svg {
width: 1em;
height: 1em;
display: inline-block;
fill: $brand-grey-light;
margin-right: $spacer / 8;
margin-left: -.2rem;
margin-bottom: -.2rem;
}
}
.forkLine {
display: inline;
margin-left: $spacer / 4;
font-size: $font-size-mini;
font-family: $font-family-monospace;
font-weight: $font-weight-base;
color: $brand-grey-light;
} }
.repositoryRelease { .repositoryRelease {