1
0
mirror of https://github.com/kremalicious/portfolio.git synced 2024-06-28 00:27:40 +02:00
portfolio/src/components/molecules/ProjectNav.jsx

49 lines
1.0 KiB
React
Raw Normal View History

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
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}>
<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>
)
}
const ProjectNav = ({ projects }) => (
2018-06-11 19:48:38 +02:00
<FullWidth>
<nav className={styles.projectNav}>
{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
)
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 = {
projects: PropTypes.object
2018-04-16 22:32:30 +02:00
}
export default ProjectNav