Last active
June 6, 2018 13:29
-
-
Save stefanoverna/750193e973344dbbd186bda0ef60ecd7 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.site.siteMetadata.products.map(product => ( | |
<div className="Catalogue__item" key={product.slug}> | |
<a href="#" className="Product"> | |
<div className="Product__image"> | |
<img src={product.image} /> | |
</div> | |
<div className="Product__details"> | |
<div className="Product__name"> | |
{product.name} | |
<span className="Product__price"> | |
{product.price}€ | |
</span> | |
</div> | |
<div className="Product__buy">Buy now</div> | |
</div> | |
</a> | |
</div> | |
)) | |
} | |
</div> | |
) | |
export default IndexPage | |
export const query = graphql` | |
query CatalogueQuery { | |
site { | |
siteMetadata { | |
products { | |
slug | |
name | |
image | |
price | |
} | |
} | |
} | |
} | |
` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment