Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@fourjuaneight
Created January 18, 2020 22:43
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 fourjuaneight/68f1f51b320721caf4e98478ca78ce0e to your computer and use it in GitHub Desktop.
Save fourjuaneight/68f1f51b320721caf4e98478ca78ce0e to your computer and use it in GitHub Desktop.
// src/pages/index.js
const Homepage = ({ location }) => {
const {
allCosmicjsProducts: { edges },
} = useStaticQuery(graphql`
query {
allCosmicjsProducts {
edges {
node {
content
metadata {
id
image {
imgix_url
url
}
price
}
slug
title
}
}
}
}
`);
return (
<Layout location={location}>
<Heading level="1">Latest Products</Heading>
{edges.map(({ node }) => (
<Product key={node.slug} product={node} url={location.href} />
))}
</Layout>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment