Initial commit
This commit is contained in:
commit
5a3bf52ebb
86 changed files with 2639 additions and 0 deletions
102
web/src/templates/project.js
Normal file
102
web/src/templates/project.js
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
import React from 'react'
|
||||
import {graphql} from 'gatsby'
|
||||
import Container from '../components/container'
|
||||
import GraphQLErrorList from '../components/graphql-error-list'
|
||||
import Project from '../components/project'
|
||||
import SEO from '../components/seo'
|
||||
import Layout from '../containers/layout'
|
||||
|
||||
export const query = graphql`
|
||||
query ProjectTemplateQuery($id: String!) {
|
||||
project: sanityProject(id: {eq: $id}) {
|
||||
id
|
||||
publishedAt
|
||||
categories {
|
||||
_id
|
||||
title
|
||||
}
|
||||
relatedProjects {
|
||||
title
|
||||
_id
|
||||
slug {
|
||||
current
|
||||
}
|
||||
}
|
||||
mainImage {
|
||||
crop {
|
||||
_key
|
||||
_type
|
||||
top
|
||||
bottom
|
||||
left
|
||||
right
|
||||
}
|
||||
hotspot {
|
||||
_key
|
||||
_type
|
||||
x
|
||||
y
|
||||
height
|
||||
width
|
||||
}
|
||||
asset {
|
||||
_id
|
||||
}
|
||||
alt
|
||||
}
|
||||
title
|
||||
slug {
|
||||
current
|
||||
}
|
||||
_rawBody
|
||||
members {
|
||||
_key
|
||||
person {
|
||||
image {
|
||||
crop {
|
||||
_key
|
||||
_type
|
||||
top
|
||||
bottom
|
||||
left
|
||||
right
|
||||
}
|
||||
hotspot {
|
||||
_key
|
||||
_type
|
||||
x
|
||||
y
|
||||
height
|
||||
width
|
||||
}
|
||||
asset {
|
||||
_id
|
||||
}
|
||||
}
|
||||
name
|
||||
}
|
||||
roles
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
const ProjectTemplate = props => {
|
||||
const {data, errors} = props
|
||||
const project = data && data.project
|
||||
return (
|
||||
<Layout>
|
||||
{errors && <SEO title='GraphQL Error' />}
|
||||
{project && <SEO title={project.title || 'Untitled'} />}
|
||||
|
||||
{errors && (
|
||||
<Container>
|
||||
<GraphQLErrorList errors={errors} />
|
||||
</Container>
|
||||
)}
|
||||
{project && <Project {...project} />}
|
||||
</Layout>
|
||||
)
|
||||
}
|
||||
|
||||
export default ProjectTemplate
|
||||
Loading…
Add table
Add a link
Reference in a new issue