1
0
mirror of https://github.com/kremalicious/portfolio.git synced 2025-02-14 21:10:41 +01:00

add location prop to pages

This commit is contained in:
Matthias Kretschmann 2018-06-23 00:54:45 +02:00
parent 3b4500173f
commit fdd6428bb8
Signed by: m
GPG Key ID: 606EEEF3C479A91F
3 changed files with 13 additions and 6 deletions

View File

@ -1,4 +1,5 @@
import React, { Component } from 'react' import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { Link } from 'gatsby' import { Link } from 'gatsby'
import giphyAPI from 'giphy-js-sdk-core' import giphyAPI from 'giphy-js-sdk-core'
import Layout from '../components/Layout' import Layout from '../components/Layout'
@ -41,7 +42,7 @@ class NotFound extends Component {
render() { render() {
return ( return (
<Layout> <Layout location={this.props.location}>
<Content className="content content--404"> <Content className="content content--404">
<h1>Shenanigans, page not found.</h1> <h1>Shenanigans, page not found.</h1>
<p> <p>
@ -63,4 +64,8 @@ class NotFound extends Component {
} }
} }
NotFound.propTypes = {
location: PropTypes.object
}
export default NotFound export default NotFound

View File

@ -6,11 +6,11 @@ import ProjectImage from '../components/atoms/ProjectImage'
import FullWidth from '../components/atoms/FullWidth' import FullWidth from '../components/atoms/FullWidth'
import styles from './index.module.scss' import styles from './index.module.scss'
const Home = ({ data }) => { const Home = ({ data, location }) => {
const projects = data.allProjectsYaml.edges const projects = data.allProjectsYaml.edges
return ( return (
<Layout> <Layout location={location}>
<FullWidth className="projects"> <FullWidth className="projects">
{projects.map(({ node }) => { {projects.map(({ node }) => {
const { slug, title, img } = node const { slug, title, img } = node
@ -30,7 +30,8 @@ const Home = ({ data }) => {
} }
Home.propTypes = { Home.propTypes = {
data: PropTypes.object data: PropTypes.object,
location: PropTypes.object
} }
export default Home export default Home

View File

@ -50,7 +50,7 @@ class Project extends Component {
const { title, links, techstack } = project const { title, links, techstack } = project
return ( return (
<Layout> <Layout location={this.props.location}>
<Helmet title={title} /> <Helmet title={title} />
<SEO project={project} meta={meta} /> <SEO project={project} meta={meta} />
@ -84,7 +84,8 @@ ProjectImages.propTypes = {
} }
Project.propTypes = { Project.propTypes = {
data: PropTypes.object.isRequired data: PropTypes.object.isRequired,
location: PropTypes.object.isRequired
} }
export default Project export default Project