Created
June 7, 2018 15:18
-
-
Save stefanoverna/5b0d53f13681e34b78229cf29f0c6de7 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' | |
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 src={product.image.url} /> | |
</div> | |
<div className="Product__details"> | |
<div className="Product__name"> | |
{product.name} | |
<div className="Product__price"> | |
{product.price}€ | |
</div> | |
</div> | |
<span className="Product__buy">Buy now</span> | |
</div> | |
</a> | |
</div> | |
)) | |
} | |
</div> | |
) | |
export default IndexPage | |
export const query = graphql` | |
query CatalogueQuery { | |
products: allDatoCmsProduct { | |
edges { | |
node { | |
id | |
name | |
price | |
image { | |
url | |
} | |
} | |
} | |
} | |
} | |
` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment