1
0
mirror of https://github.com/kremalicious/portfolio.git synced 2024-12-22 17:23:22 +01:00

add issue link in footer, read in package.json as GraphQL data

This commit is contained in:
Matthias Kretschmann 2018-05-14 20:10:59 +02:00
parent 5fccd3483e
commit 492181842a
Signed by: m
GPG Key ID: 606EEEF3C479A91F
5 changed files with 36 additions and 2 deletions

View File

@ -16,6 +16,20 @@ module.exports = {
'gatsby-plugin-sharp', 'gatsby-plugin-sharp',
'gatsby-plugin-sitemap', 'gatsby-plugin-sitemap',
'gatsby-plugin-offline', 'gatsby-plugin-offline',
{
resolve: 'gatsby-transformer-json',
options: {
plugins: [
{
resolve: 'gatsby-source-filesystem',
options: {
name: 'pkg',
path: path.join(__dirname, 'package.json'),
},
},
],
},
},
{ {
resolve: 'gatsby-plugin-sass', resolve: 'gatsby-plugin-sass',
options: { options: {

View File

@ -1,7 +1,11 @@
{ {
"name": "portfolio", "name": "portfolio",
"version": "0.1.0", "version": "0.1.0",
"private": true, "homepage": "https://matthiaskretschmann.com",
"repository": "github:kremalicious/portfolio",
"bugs": "https://github.com/kremalicious/portfolio/issues",
"license": "MIT",
"author": "Matthias Kretschmann <m@kretschmann.io>",
"scripts": { "scripts": {
"lint:js": "eslint ./gatsby-*.{js,jsx} && eslint ./src/**/*.{js,jsx}", "lint:js": "eslint ./gatsby-*.{js,jsx} && eslint ./src/**/*.{js,jsx}",
"lint:css": "stylelint ./src/**/*.{css,scss}", "lint:css": "stylelint ./src/**/*.{css,scss}",
@ -51,6 +55,7 @@
"eslint-plugin-graphql": "^2.1.1", "eslint-plugin-graphql": "^2.1.1",
"eslint-plugin-prettier": "^2.6.0", "eslint-plugin-prettier": "^2.6.0",
"eslint-plugin-react": "^7.8.2", "eslint-plugin-react": "^7.8.2",
"gatsby-transformer-json": "^1.0.17",
"ora": "^2.1.0", "ora": "^2.1.0",
"prepend": "^1.0.2", "prepend": "^1.0.2",
"prettier": "^1.12.1", "prettier": "^1.12.1",

View File

@ -14,6 +14,7 @@ class Footer extends PureComponent {
render() { render() {
const meta = this.props.meta const meta = this.props.meta
const pkg = this.props.pkg
return ( return (
<footer className="footer"> <footer className="footer">
@ -23,6 +24,7 @@ class Footer extends PureComponent {
<p className="footer__actions"> <p className="footer__actions">
<Vcard meta={meta} /> <Vcard meta={meta} />
<a href={meta.gpg}>PGP/GPG key</a> <a href={meta.gpg}>PGP/GPG key</a>
<a href={pkg.bugs}>Found a bug?</a>
</p> </p>
<p className="footer__copyright"> <p className="footer__copyright">
<small> <small>
@ -36,6 +38,7 @@ class Footer extends PureComponent {
Footer.propTypes = { Footer.propTypes = {
meta: PropTypes.object, meta: PropTypes.object,
pkg: PropTypes.object,
} }
export default Footer export default Footer

View File

@ -23,6 +23,7 @@ const Main = ({ children }) => <main className="screen">{children}</main>
const TemplateWrapper = ({ data, location, children }) => { const TemplateWrapper = ({ data, location, children }) => {
const meta = data.dataYaml const meta = data.dataYaml
const pkg = data.portfolioJson
const isHomepage = location.pathname === '/' const isHomepage = location.pathname === '/'
return ( return (
@ -41,7 +42,7 @@ const TemplateWrapper = ({ data, location, children }) => {
</FadeIn> </FadeIn>
</TransitionGroup> </TransitionGroup>
<Footer meta={meta} /> <Footer meta={meta} pkg={pkg} />
</Fragment> </Fragment>
) )
} }
@ -65,6 +66,7 @@ export default withRouter(TemplateWrapper)
export const query = graphql` export const query = graphql`
query metaQuery { query metaQuery {
# the data/meta.yml file
dataYaml { dataYaml {
title title
tagline tagline
@ -103,5 +105,13 @@ export const query = graphql`
gpg gpg
addressbook addressbook
} }
# the package.json file
portfolioJson {
name
homepage
repository
bugs
}
} }
` `

View File

@ -92,6 +92,8 @@ export const projectQuery = graphql`
} }
} }
} }
# the data/meta.yml file
dataYaml { dataYaml {
title title
tagline tagline