Last active
June 7, 2018 15:47
-
-
Save stefanoverna/361cde03949d422b7c2b5a0ca23b323b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import Img from 'gatsby-image' | |
const IndexPage = ({ data }) => ( | |
<div className="Catalogue"> | |
{ | |
data.products.edges.map(({ node: product }) => ( | |
<div className="Catalogue__item" key={product.id}> | |
<a href="#" className="Product"> | |
<div className="Product__image"> | |
<Img sizes={product.image.sizes} /> | |
</div> | |
{ /*... */ } | |
</a> | |
</div> | |
)) | |
} | |
</div> | |
) | |
export default IndexPage | |
export const query = graphql` | |
query CatalogueQuery { | |
products: allDatoCmsProduct { | |
edges { | |
node { | |
id | |
name | |
price | |
image { | |
sizes(maxWidth: 300, imgixParams: { fm: "jpg" }) { | |
...GatsbyDatoCmsSizes | |
} | |
} | |
} | |
} | |
} | |
} | |
` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment