Skip to content

Commit

Permalink
feat: add default images for products without image in off.html #208 (#…
Browse files Browse the repository at this point in the history
…220)

I added the
src="https://world.openfoodfacts.org/images/icons/dist/packaging.svg" as
a default image in off.html

fixes: #208
  • Loading branch information
GitPersSiham authored Jul 16, 2024
1 parent 2d17d6d commit e4456f3
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions frontend/public/off.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
height: 144px;
margin: 12px;
}

searchalicious-results::part(image) {
object-fit: contain;
width: 100%;
Expand Down Expand Up @@ -395,6 +396,7 @@
loading="lazy"
part="image"
src="${result.image_small_url}"
onerror="handleImageError(event)"
/>
</div>
<div part="product-name">
Expand Down Expand Up @@ -451,7 +453,14 @@
<script src="https://static.openfoodfacts.org/js/dist/scrollNav.js"></script>

<script src="vega5.js"></script>
<script>
const defaultImageUrl = 'https://world.openfoodfacts.org/images/icons/dist/packaging.svg';

function handleImageError(event) {
event.target.src = defaultImageUrl;

}
</script>
<script
src="https://static.openfoodfacts.org/js/dist/foundation.js"
data-base-layout="true"
Expand Down

0 comments on commit e4456f3

Please sign in to comment.