2018-11-25 00:15:02 +01:00
|
|
|
import React from 'react'
|
2018-04-21 13:39:18 +02:00
|
|
|
import PropTypes from 'prop-types'
|
2018-06-21 21:06:53 +02:00
|
|
|
import { graphql } from 'gatsby'
|
2018-04-21 13:39:18 +02:00
|
|
|
import FullWidth from '../components/atoms/FullWidth'
|
2018-09-15 19:51:10 +02:00
|
|
|
import ProjectImage from '../components/molecules/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-06-23 15:50:02 +02:00
|
|
|
import styles from './Project.module.scss'
|
2018-04-21 13:39:18 +02:00
|
|
|
|
2018-07-11 11:10:13 +02:00
|
|
|
const ProjectMeta = ({ links, techstack }) => (
|
2018-10-17 20:26:08 +02:00
|
|
|
<footer className={styles.meta}>
|
2018-07-11 11:10:13 +02:00
|
|
|
{!!links && <ProjectLinks links={links} />}
|
|
|
|
{!!techstack && <ProjectTechstack techstack={techstack} />}
|
|
|
|
</footer>
|
|
|
|
)
|
2018-05-22 22:41:59 +02:00
|
|
|
|
2018-07-11 11:10:13 +02:00
|
|
|
const ProjectImages = ({ projectImages, title }) => (
|
2018-05-23 00:03:46 +02:00
|
|
|
<FullWidth>
|
2018-07-11 11:10:13 +02:00
|
|
|
{projectImages.map(({ node }) => (
|
2018-10-17 20:26:08 +02:00
|
|
|
<div className={styles.imageWrap} key={node.id}>
|
2018-07-11 11:10:13 +02:00
|
|
|
<ProjectImage fluid={node.fluid} alt={title} />
|
2018-06-23 15:50:02 +02:00
|
|
|
</div>
|
2018-05-23 00:03:46 +02:00
|
|
|
))}
|
|
|
|
</FullWidth>
|
|
|
|
)
|
|
|
|
|
2018-09-14 20:22:57 +02:00
|
|
|
const Project = ({ data }) => {
|
2018-07-11 11:10:13 +02:00
|
|
|
const project = data.projectsYaml
|
|
|
|
const projectImages = data.projectImages.edges
|
|
|
|
const { title, links, techstack } = project
|
|
|
|
const description = data.projectsYaml.description
|
|
|
|
const descriptionWithLineBreaks = description.split('\n').join('\n\n')
|
2018-05-11 21:44:34 +02:00
|
|
|
|
2018-07-11 11:10:13 +02:00
|
|
|
return (
|
2018-11-25 00:15:02 +01:00
|
|
|
<>
|
2018-08-26 21:28:06 +02:00
|
|
|
<SEO project={project} />
|
2018-04-23 23:55:12 +02:00
|
|
|
|
2018-10-17 01:24:49 +02:00
|
|
|
<article>
|
|
|
|
<header>
|
2018-10-17 20:26:08 +02:00
|
|
|
<h1 className={styles.title}>{title}</h1>
|
2018-10-17 01:24:49 +02:00
|
|
|
</header>
|
2018-11-25 01:52:25 +01:00
|
|
|
<div
|
2018-10-17 20:26:08 +02:00
|
|
|
className={styles.description}
|
2018-11-25 01:52:25 +01:00
|
|
|
dangerouslySetInnerHTML={{ __html: descriptionHtml }}
|
2018-10-17 01:24:49 +02:00
|
|
|
/>
|
|
|
|
<ProjectImages projectImages={projectImages} title={title} />
|
|
|
|
<ProjectMeta links={links} techstack={techstack} />
|
2018-07-11 11:10:13 +02:00
|
|
|
</article>
|
2018-04-21 13:39:18 +02:00
|
|
|
|
2018-07-11 11:10:13 +02:00
|
|
|
<ProjectNav slug={project.slug} />
|
2018-11-25 00:15:02 +01:00
|
|
|
</>
|
2018-07-11 11:10:13 +02:00
|
|
|
)
|
2018-04-21 13:39:18 +02:00
|
|
|
}
|
|
|
|
|
2018-05-22 22:41:59 +02:00
|
|
|
ProjectMeta.propTypes = {
|
|
|
|
links: PropTypes.array,
|
|
|
|
techstack: PropTypes.array
|
|
|
|
}
|
|
|
|
|
2018-05-23 00:03:46 +02:00
|
|
|
ProjectImages.propTypes = {
|
|
|
|
projectImages: PropTypes.array,
|
|
|
|
title: PropTypes.string
|
|
|
|
}
|
|
|
|
|
2018-04-21 13:39:18 +02:00
|
|
|
Project.propTypes = {
|
2018-06-23 00:54:45 +02:00
|
|
|
data: PropTypes.object.isRequired,
|
|
|
|
location: PropTypes.object.isRequired
|
2018-04-21 13:39:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export default Project
|
|
|
|
|
2018-06-11 21:11:18 +02:00
|
|
|
export const projectAndProjectsQuery = graphql`
|
2018-07-11 15:54:32 +02:00
|
|
|
query($slug: String!) {
|
2018-05-05 00:17:26 +02:00
|
|
|
projectsYaml(slug: { eq: $slug }) {
|
2018-05-04 14:00:21 +02:00
|
|
|
title
|
|
|
|
slug
|
|
|
|
description
|
|
|
|
links {
|
|
|
|
title
|
|
|
|
url
|
2018-11-24 15:02:32 +01:00
|
|
|
type
|
2018-04-21 13:39:18 +02:00
|
|
|
}
|
2018-05-04 14:00:21 +02:00
|
|
|
techstack
|
2018-05-07 01:43:33 +02:00
|
|
|
img {
|
|
|
|
childImageSharp {
|
|
|
|
twitterImage: resize(width: 980) {
|
|
|
|
src
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-04-21 13:39:18 +02:00
|
|
|
}
|
2018-05-14 20:10:59 +02:00
|
|
|
|
2018-05-04 16:54:08 +02:00
|
|
|
projectImages: allImageSharp(
|
2018-06-19 22:48:33 +02:00
|
|
|
filter: { fluid: { originalName: { regex: $slug } } }
|
2018-07-14 02:18:22 +02:00
|
|
|
sort: { fields: [fluid___originalName], order: ASC }
|
2018-05-04 16:54:08 +02:00
|
|
|
) {
|
2018-05-04 01:58:43 +02:00
|
|
|
edges {
|
|
|
|
node {
|
|
|
|
id
|
2018-06-19 22:48:33 +02:00
|
|
|
...ProjectImageFluid
|
2018-04-21 20:01:50 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-04-21 13:39:18 +02:00
|
|
|
}
|
|
|
|
`
|