Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8720 contributor links #9101

Merged
merged 12 commits into from
Feb 5, 2025
78 changes: 35 additions & 43 deletions src/templates/contributor.js
Original file line number Diff line number Diff line change
@@ -1,50 +1,46 @@
import React from "react"
import { graphql, Link } from "gatsby"
import Layout from "../layout/layout"
import SEO from "../layout/seo"
import ContributorLink from "../components/ContributorLink"
import React from 'react';
import { graphql, Link } from 'gatsby';
import Layout from '../layout/layout';
import SEO from '../layout/seo';
import ContributorLink from '../components/ContributorLink';

import { Container, TwoItemLayout } from "@pantheon-systems/pds-toolkit-react"
import { Container, TwoItemLayout } from '@pantheon-systems/pds-toolkit-react';

const links = [
{
property: "url",
icon: "user",
property: 'url',
icon: 'user',
},
{
property: "github",
icon: "github",
property: 'github',
icon: 'github',
},
{
property: "drupal",
icon: "drupal",
property: 'drupal',
icon: 'drupal',
},
{
property: "wordpress",
icon: "wordpress",
property: 'wordpress',
icon: 'wordpress',
},
{
property: "twitter",
icon: "twitter",
property: 'twitter',
icon: 'twitter',
},
{
property: "linkedin",
icon: "linkedin",
property: 'linkedin',
icon: 'linkedin',
},
]
];

// Set container width for search and main content.
const containerWidth = "standard"
const containerWidth = 'standard';

class ContributorTemplate extends React.Component {
render() {
const contributor = this.props.data.contributorYaml
const docs =
this.props.data.allDocs != null ? this.props.data.allDocs.edges : []
let printedGuides = []
let printedOverview = []
const contributor = this.props.data.contributorYaml;

console.log(contributor)
// console.log(contributor)

return (
<Layout containerWidth={containerWidth} footerBorder>
Expand All @@ -70,11 +66,11 @@ class ContributorTemplate extends React.Component {
{links.map((link, i) => {
const url = contributor.hasOwnProperty(link.property)
? contributor[link.property]
: null
: null;
if (url !== null) {
return (
<ContributorLink key={i} url={url} icon={link.icon} />
)
);
}
})}
</div>
Expand All @@ -84,29 +80,24 @@ class ContributorTemplate extends React.Component {
slot="second-item"
className="docs-contributor__contributions"
>
<h2>Contributions</h2>
<ul className="docs-contributor__list">
{docs.map(({ node }) => {
return (
<li key={node.id}>
<Link to={`/${node.publicURL}`}>
{node.frontmatter.title}
</Link>
</li>
)
})}
</ul>
<h2>
<a
href={`https://github.com/pantheon-systems/documentation/commits?author=${contributor.yamlId}`}
>
See contributions on GitHub
</a>
</h2>
</div>
</TwoItemLayout>
</div>
</Container>
</main>
</Layout>
)
);
}
}

export default ContributorTemplate
export default ContributorTemplate;

export const pageQuery = graphql`
query ContributorById($id: String!) {
Expand Down Expand Up @@ -137,6 +128,7 @@ export const pageQuery = graphql`
id
frontmatter {
title
permalink
}
fileAbsolutePath
}
Expand All @@ -151,4 +143,4 @@ export const pageQuery = graphql`
}
}
}
`
`;