Code clean
This commit is contained in:
@@ -36,20 +36,20 @@
|
|||||||
currentIndex = photos.findIndex(photo => photo.slug === init.params.photo)
|
currentIndex = photos.findIndex(photo => photo.slug === init.params.photo)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change the current index depending on direction
|
// Change current index from param
|
||||||
const goToPhoto = direction => {
|
const goToPhoto = to => {
|
||||||
if (direction === 'prev') {
|
if (to === 'prev') {
|
||||||
currentIndex--
|
currentIndex--
|
||||||
currentIndex = (currentIndex < 0) ? photos.length - 1 : currentIndex
|
currentIndex = (currentIndex < 0) ? photos.length - 1 : currentIndex
|
||||||
} else if (direction === 'next') {
|
} else if (to === 'next') {
|
||||||
currentIndex++
|
currentIndex++
|
||||||
currentIndex = (currentIndex >= photos.length) ? 0 : currentIndex
|
currentIndex = (currentIndex >= photos.length) ? 0 : currentIndex
|
||||||
} else {
|
} else {
|
||||||
currentIndex = direction
|
currentIndex = to
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send current photo to event
|
// Dispatch current photo
|
||||||
sendCurrentPhoto({ init: false })
|
sendCurrentPhoto()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send current photo to event
|
// Send current photo to event
|
||||||
@@ -94,7 +94,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Run code on browser only
|
** Run code when mounted
|
||||||
*/
|
*/
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
// Entering transition
|
// Entering transition
|
||||||
@@ -124,7 +124,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send current photo to event for init
|
// Dispatch current photo for init
|
||||||
sendCurrentPhoto({ init: true })
|
sendCurrentPhoto({ init: true })
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -191,9 +191,11 @@ button {
|
|||||||
color: $color-tertiary;
|
color: $color-tertiary;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
letter-spacing: 1px;
|
letter-spacing: 1px;
|
||||||
}
|
|
||||||
.style-caps--transparent {
|
// Transparent variant
|
||||||
|
&--transparent {
|
||||||
color: rgba($color-tertiary, 0.5);
|
color: rgba($color-tertiary, 0.5);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.style-description {
|
.style-description {
|
||||||
|
|||||||
@@ -65,10 +65,9 @@
|
|||||||
background-color: $color-secondary;
|
background-color: $color-secondary;
|
||||||
border-radius: 100%;
|
border-radius: 100%;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Place
|
// Place pin
|
||||||
.pin--place {
|
&--place {
|
||||||
font-family: $font-serif;
|
font-family: $font-serif;
|
||||||
|
|
||||||
a {
|
a {
|
||||||
@@ -77,14 +76,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Country
|
// Country text
|
||||||
.pin--country {
|
&--country {
|
||||||
font-family: $font-sans;
|
font-family: $font-sans;
|
||||||
font-size: rem(10px);
|
font-size: rem(10px);
|
||||||
color: rgba(#fff, 0.5);
|
color: rgba(#fff, 0.5);
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
letter-spacing: 1px;
|
letter-spacing: 1px;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ export let currentLocation = writable()
|
|||||||
export let currentPhotos = writable()
|
export let currentPhotos = writable()
|
||||||
|
|
||||||
// State
|
// State
|
||||||
// export let ready = writable(false)
|
|
||||||
export let pageReady = writable(false)
|
export let pageReady = writable(false)
|
||||||
export const pageTransition = {
|
export const pageTransition = {
|
||||||
onAnimationEnd () {}
|
onAnimationEnd () {}
|
||||||
|
|||||||
Reference in New Issue
Block a user