Issue/79 fallback image (#179)

* Filter products from the homepage grid display when they do not have and image. Provide a fallback/placeholder image for the ProductCard for when a product does not have an image.

* Avoid repeating placeholder image reference and move to a variable

* Remove filter to avoid additional computations as per https://github.com/vercel/commerce/pull/80#discussion_r531142893. Placeholder images will display as fallback.

* Filter products from the homepage grid display when they do not have and image. Provide a fallback/placeholder image for the ProductCard for when a product does not have an image.

* Avoid repeating placeholder image reference and move to a variable

* Remove filter to avoid additional computations as per https://github.com/vercel/commerce/pull/80#discussion_r531142893. Placeholder images will display as fallback.

* Remove comment about filter. Code removed so no longer needed.

Co-authored-by: B <curciobelen@gmail.com>
This commit is contained in:
Leah Wagner
2021-01-28 09:09:28 -08:00
committed by GitHub
parent 027c4aca70
commit 08a6b2efcf
3 changed files with 11 additions and 2 deletions

View File

@@ -44,6 +44,7 @@ export async function getStaticProps({
// We prefer to do the computation at buildtime/servertime
const { featured, bestSelling } = (() => {
// Create a copy of products that we can mutate
// Filter products that do not have images
const products = [...newestProducts]
// If the lists of featured and best selling products don't have enough
// products, then fill them with products from the products list, this