2018-04-16 22:32:30 +02:00
|
|
|
import React from 'react'
|
|
|
|
import PropTypes from 'prop-types'
|
|
|
|
import Link from 'gatsby-link'
|
2018-05-04 01:58:43 +02:00
|
|
|
import Img from 'gatsby-image'
|
2018-06-11 19:48:38 +02:00
|
|
|
import FullWidth from '../atoms/FullWidth'
|
|
|
|
import styles from './ProjectNav.module.scss'
|
2018-04-16 22:32:30 +02:00
|
|
|
|
2018-06-11 21:11:18 +02:00
|
|
|
const ProjectItem = ({ title, slug, img }) => {
|
2018-05-23 00:03:46 +02:00
|
|
|
return (
|
2018-06-11 19:48:38 +02:00
|
|
|
<div className={styles.item}>
|
2018-06-11 21:11:18 +02:00
|
|
|
<Link className={styles.link} to={slug}>
|
2018-05-23 00:03:46 +02:00
|
|
|
<Img
|
2018-06-11 19:48:38 +02:00
|
|
|
className={styles.image}
|
2018-05-23 00:03:46 +02:00
|
|
|
sizes={img.childImageSharp.sizes}
|
|
|
|
alt={title}
|
|
|
|
/>
|
2018-06-11 19:48:38 +02:00
|
|
|
<h1 className={styles.title}>{title}</h1>
|
2018-05-23 00:03:46 +02:00
|
|
|
</Link>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2018-06-11 21:11:18 +02:00
|
|
|
const ProjectNav = ({ projects }) => (
|
2018-06-11 19:48:38 +02:00
|
|
|
<FullWidth>
|
|
|
|
<nav className={styles.projectNav}>
|
2018-06-11 21:11:18 +02:00
|
|
|
{projects.map(({ node }) => (
|
|
|
|
<ProjectItem
|
|
|
|
key={node.slug}
|
|
|
|
title={node.title}
|
|
|
|
slug={node.slug}
|
|
|
|
img={node.img}
|
|
|
|
/>
|
|
|
|
))}
|
2018-06-11 19:48:38 +02:00
|
|
|
</nav>
|
|
|
|
</FullWidth>
|
2018-04-16 22:32:30 +02:00
|
|
|
)
|
|
|
|
|
2018-06-11 21:11:18 +02:00
|
|
|
ProjectItem.propTypes = {
|
|
|
|
title: PropTypes.string,
|
|
|
|
slug: PropTypes.string,
|
|
|
|
img: PropTypes.object
|
2018-05-23 00:03:46 +02:00
|
|
|
}
|
|
|
|
|
2018-04-16 22:32:30 +02:00
|
|
|
ProjectNav.propTypes = {
|
2018-06-11 21:11:18 +02:00
|
|
|
projects: PropTypes.object
|
2018-04-16 22:32:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export default ProjectNav
|