2018-04-24 22:56:19 +02:00
|
|
|
import React, { Component, Fragment } from 'react'
|
2018-04-21 13:39:18 +02:00
|
|
|
import PropTypes from 'prop-types'
|
|
|
|
import Helmet from 'react-helmet'
|
|
|
|
import ReactMarkdown from 'react-markdown'
|
|
|
|
import Content from '../components/atoms/Content'
|
|
|
|
import FullWidth from '../components/atoms/FullWidth'
|
2018-05-04 01:58:43 +02:00
|
|
|
import ProjectImage from '../components/atoms/ProjectImage'
|
2018-04-21 13:39:18 +02:00
|
|
|
import ProjectTechstack from '../components/molecules/ProjectTechstack'
|
|
|
|
import ProjectLinks from '../components/molecules/ProjectLinks'
|
2018-05-04 14:00:21 +02:00
|
|
|
import ProjectNav from '../components/molecules/ProjectNav'
|
2018-04-23 23:55:12 +02:00
|
|
|
import SEO from '../components/atoms/SEO'
|
2018-04-21 13:39:18 +02:00
|
|
|
import './Project.scss'
|
|
|
|
|
2018-04-22 23:51:50 +02:00
|
|
|
class Project extends Component {
|
2018-04-21 13:39:18 +02:00
|
|
|
constructor() {
|
|
|
|
super()
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
2018-05-04 14:00:21 +02:00
|
|
|
const project = this.props.data.projectsJson
|
2018-05-04 01:58:43 +02:00
|
|
|
const projectImages = this.props.data.projectImages.edges
|
2018-05-04 14:00:21 +02:00
|
|
|
const pathContext = this.props.pathContext
|
2018-04-23 23:55:12 +02:00
|
|
|
|
2018-05-04 14:00:21 +02:00
|
|
|
const { title, description, links, techstack } = project
|
|
|
|
const { next, previous } = pathContext
|
2018-04-21 13:39:18 +02:00
|
|
|
|
2018-05-04 01:58:43 +02:00
|
|
|
return (
|
|
|
|
<Fragment>
|
2018-04-21 13:39:18 +02:00
|
|
|
<Helmet>
|
|
|
|
<title>{title}</title>
|
|
|
|
</Helmet>
|
|
|
|
|
2018-05-04 14:00:21 +02:00
|
|
|
<SEO postMeta={project} />
|
2018-04-23 23:55:12 +02:00
|
|
|
|
2018-04-21 13:39:18 +02:00
|
|
|
<article className="project">
|
|
|
|
<Content>
|
|
|
|
<h1 className="project__title">{title}</h1>
|
2018-05-04 01:58:43 +02:00
|
|
|
<ReactMarkdown
|
|
|
|
source={description}
|
|
|
|
escapeHtml={false}
|
|
|
|
className="project__description"
|
|
|
|
/>
|
2018-04-21 13:39:18 +02:00
|
|
|
|
2018-04-30 01:18:54 +02:00
|
|
|
<FullWidth>
|
2018-05-04 01:58:43 +02:00
|
|
|
{projectImages.map(({ node }) => (
|
|
|
|
<ProjectImage
|
|
|
|
key={node.id}
|
|
|
|
sizes={node.sizes}
|
|
|
|
alt={title}
|
|
|
|
/>
|
|
|
|
))}
|
2018-04-21 13:39:18 +02:00
|
|
|
</FullWidth>
|
|
|
|
|
|
|
|
<footer className="project__meta">
|
|
|
|
{!!techstack && <ProjectTechstack techstack={techstack} />}
|
|
|
|
{!!links && <ProjectLinks links={links} />}
|
|
|
|
</footer>
|
|
|
|
</Content>
|
|
|
|
</article>
|
|
|
|
|
2018-05-04 14:00:21 +02:00
|
|
|
<ProjectNav previous={previous} next={next} />
|
2018-04-24 22:56:19 +02:00
|
|
|
</Fragment>
|
2018-05-04 01:58:43 +02:00
|
|
|
)
|
2018-04-21 13:39:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Project.propTypes = {
|
|
|
|
data: PropTypes.object.isRequired,
|
2018-05-04 14:00:21 +02:00
|
|
|
pathContext: PropTypes.object.isRequired,
|
2018-04-21 13:39:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export default Project
|
|
|
|
|
|
|
|
export const projectQuery = graphql`
|
2018-05-04 01:58:43 +02:00
|
|
|
query ProjectBySlug($slug: String!) {
|
2018-05-04 14:00:21 +02:00
|
|
|
projectsJson(slug: { eq: $slug }) {
|
|
|
|
title
|
|
|
|
slug
|
|
|
|
description
|
|
|
|
links {
|
|
|
|
title
|
|
|
|
url
|
2018-04-21 13:39:18 +02:00
|
|
|
}
|
2018-05-04 14:00:21 +02:00
|
|
|
techstack
|
2018-04-21 13:39:18 +02:00
|
|
|
}
|
2018-05-04 01:58:43 +02:00
|
|
|
projectImages: allImageSharp(filter: { id: { regex: $slug } }, sort: { fields: [id], order: ASC }) {
|
|
|
|
edges {
|
|
|
|
node {
|
|
|
|
id
|
2018-05-04 14:00:21 +02:00
|
|
|
...ProjectImageSizes
|
2018-04-21 20:01:50 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-04-21 13:39:18 +02:00
|
|
|
}
|
|
|
|
`
|