Skip to content

Commit

Permalink
Merge pull request #2465 from patzick/feature/category-page-images
Browse files Browse the repository at this point in the history
Feature/improve load images on category page
  • Loading branch information
patzick committed Feb 20, 2019
2 parents 269bc55 + 882146c commit 734e4c6
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Updated to Vue 2.6.6 - @filrak (#2456)
- Null sidebar menu data on static page fixed - @filrak (#2456)
- Fix cannot edit previous steps in checkout - @filrak (#2457)
- Improve images loading on category page, corrected alt view and blinking problem - @patzick (#2465)

## [1.8.2] - 2019.02.11
- Fixed docker-compose configuration for network_mode and TS build config - @lukeromanowicz (#2415)
Expand Down
33 changes: 33 additions & 0 deletions src/themes/default/assets/placeholder.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 27 additions & 2 deletions src/themes/default/components/core/ProductTile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@
>
<div
class="product-image relative bg-cl-secondary"
:class="[{ sale: labelsActive && isOnSale }, { new: labelsActive && isNew }]">
:class="[{ sale: labelsActive && isOnSale }, { new: labelsActive && isNew }, {'product-image--loaded': imageLoaded}]">
<img
class="product-image__content"
:alt="product.name"
:src="thumbnailObj.src"
v-lazy="thumbnailObj"
height="300"
width="310"
data-testid="productImage"
@load="imageLoaded = true"
>
</div>

Expand Down Expand Up @@ -62,6 +63,11 @@ import { ProductTile } from '@vue-storefront/core/modules/catalog/components/Pro
export default {
mixins: [ProductTile],
data () {
return {
imageLoaded: false
}
},
props: {
labelsActive: {
type: Boolean,
Expand Down Expand Up @@ -146,6 +152,25 @@ $color-white: color(white);
width: 100%;
overflow: hidden;
max-height: 300px;
height: 270px;
display: flex;
align-items: flex-end;
background-image: url('/assets/placeholder.svg');
background-repeat: no-repeat;
background-position: center;
background-size: 60% auto;
&__content {
display: none;
}
&--loaded {
background-image: none;
.product-image__content {
display: block;
}
}
&:hover {
img {
Expand Down

0 comments on commit 734e4c6

Please sign in to comment.