Use lazySizes globally
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-04-16 17:20:29 +02:00
parent 7f3f2ac3ba
commit 239a47104e
4 changed files with 9 additions and 13 deletions

View File

@@ -8,7 +8,6 @@
// Props and variables // Props and variables
export let photo export let photo
export let index export let index
export let layout = 'list'
let scope let scope
// Default size for the image // Default size for the image
@@ -57,7 +56,7 @@
<img src="data:image/png;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" <img src="data:image/png;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs="
width={defaultWidth} height={defaultHeight} width={defaultWidth} height={defaultHeight}
alt={imgAlt} alt={imgAlt}
class:lazyload={layout === 'list'} class="lazyload"
/> />
</picture> </picture>
</a> </a>

View File

@@ -5,7 +5,6 @@
import { getThumbnail, formatDate } from 'utils/functions' import { getThumbnail, formatDate } from 'utils/functions'
// Dependencies // Dependencies
import SwipeListener from 'swipe-listener' import SwipeListener from 'swipe-listener'
import lazySizes from 'lazysizes'
// Animations // Animations
import { animateIn } from 'animations/Carousel' import { animateIn } from 'animations/Carousel'
// Components // Components

View File

@@ -73,12 +73,17 @@
locations, locations,
pageReady pageReady
} from 'utils/store' } from 'utils/store'
// Components // Dependencies
import lazySizes from 'lazysizes'
// Variables // Variables
const { page } = stores() const { page } = stores()
let AnalyticsTracker let AnalyticsTracker
// Settings
lazySizes.cfg.lazyClass = 'lazyload'
/* /*
** Manipulate data ** Manipulate data

View File

@@ -32,8 +32,6 @@
pageReady pageReady
} from 'utils/store' } from 'utils/store'
import { formatDate, relativeTime, getThumbnail } from 'utils/functions' import { formatDate, relativeTime, getThumbnail } from 'utils/functions'
// Dependencies
import lazySizes from 'lazysizes'
// Components // Components
import IconGlobe from 'atoms/IconGlobe' import IconGlobe from 'atoms/IconGlobe'
import IconGlobeSmall from 'atoms/IconGlobeSmall' import IconGlobeSmall from 'atoms/IconGlobeSmall'
@@ -184,16 +182,11 @@
{#if photos} {#if photos}
<div class="photos__view wrap"> <div class="photos__view wrap">
{#each paginatedPhotos as photo, index} {#each paginatedPhotos as photo, index}
<Photo <Photo {photo} index={photos.length - photos.indexOf(photo)} />
photo={photo}
index={photos.length - photos.indexOf(photo)}
layout={layoutSetting}
/>
{/each} {/each}
</div> </div>
<Pagination <Pagination {photos} {paginatedPhotos} {photosPerPage}
{photos} {paginatedPhotos} {photosPerPage}
on:updatePagination={updatePagination} on:updatePagination={updatePagination}
/> />