Skip to content

Instantly share code, notes, and snippets.

@stefanoverna
Last active June 7, 2018 15:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stefanoverna/361cde03949d422b7c2b5a0ca23b323b to your computer and use it in GitHub Desktop.
Save stefanoverna/361cde03949d422b7c2b5a0ca23b323b to your computer and use it in GitHub Desktop.
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