Use Destructuring variables to avoid repetitions
- Easier to read and write - Also fixes fullscreen when leaving the viewer, my bad
This commit is contained in:
@@ -16,10 +16,7 @@
|
||||
let closed = false
|
||||
|
||||
// Wait for fullscreen store value
|
||||
$: {
|
||||
if ($fullscreen) openFullscreen($fullscreen)
|
||||
else closeFullscreen()
|
||||
}
|
||||
$: if ($fullscreen) openFullscreen($fullscreen)
|
||||
|
||||
|
||||
/*
|
||||
@@ -27,13 +24,14 @@
|
||||
*/
|
||||
// Open fullscreen
|
||||
const openFullscreen = throttle(currentPhoto => {
|
||||
const { name, image, location } = currentPhoto
|
||||
loading = true
|
||||
|
||||
if (!open) {
|
||||
const img = document.createElement('img')
|
||||
const imgContainer = scope.querySelector('.fullscreen__image')
|
||||
img.src = getThumbnail(currentPhoto.image.private_hash, null, 1600, 'crop', 80)
|
||||
img.alt = `${currentPhoto.name}, ${currentPhoto.location.name}, ${currentPhoto.location.country.name}`
|
||||
img.src = getThumbnail(image.private_hash, null, 1600, 'crop', 80)
|
||||
img.alt = `${name}, ${location.name}, ${location.country.name}`
|
||||
img.width = 2400
|
||||
img.height = 1600
|
||||
imgContainer.append(img)
|
||||
|
||||
Reference in New Issue
Block a user