2019-01-04 13:10:41 +00:00
|
|
|
<template>
|
2019-01-04 13:55:30 +00:00
|
|
|
<div>
|
2019-01-04 13:10:41 +00:00
|
|
|
<div class="gallery-thumbs__spacer"></div>
|
|
|
|
<ul class="gallery-thumbs__list">
|
2019-01-09 12:56:10 +00:00
|
|
|
<li v-for="(gallery, galleryIndex) in galleries"
|
2019-01-09 14:12:30 +00:00
|
|
|
:key="galleryIndex"
|
|
|
|
:class="{ 'is-active': activeRow === galleryIndex }"
|
|
|
|
class="gallery-thumbs__row-container">
|
2019-01-09 12:56:10 +00:00
|
|
|
<ul :ref="'thumbs-row-' + galleryIndex"
|
|
|
|
class="gallery-thumbs__row"
|
|
|
|
:style="{ 'transform': 'translate3d(-' + thumbRowOffsets[galleryIndex] + 'px, 0, 0)' }">
|
|
|
|
<li class="featured-image-spacer mobile-only"
|
2019-01-04 13:55:30 +00:00
|
|
|
:style="{ 'height': featuredHeight }">
|
2019-01-09 12:56:10 +00:00
|
|
|
<ThumbNav class="thumb-nav thumb-nav--large"
|
|
|
|
direction="right"
|
2019-01-09 14:12:30 +00:00
|
|
|
@navClick="handleNavClick(galleryIndex, 'right')" />
|
2019-01-04 13:55:30 +00:00
|
|
|
</li>
|
2019-01-09 12:56:10 +00:00
|
|
|
<li v-for="(image, imageIndex) in gallery.images"
|
|
|
|
:ref="galleryIndex == 0 && imageIndex == 0 ? 'thumbContainer' : null"
|
2019-01-04 13:10:41 +00:00
|
|
|
class="thumb-container"
|
2019-01-09 12:56:10 +00:00
|
|
|
:key="galleryIndex + '.' + imageIndex + '.' + image.url">
|
|
|
|
<ThumbNav class="thumb-nav thumb-nav--left"
|
|
|
|
direction="left"
|
2019-01-09 14:12:30 +00:00
|
|
|
@navClick="handleNavClick(galleryIndex, 'left')" />
|
2019-01-09 12:56:10 +00:00
|
|
|
<ThumbNav v-if="imageIndex < gallery.images.length - 1"
|
|
|
|
class="thumb-nav"
|
|
|
|
direction="right"
|
2019-01-09 14:12:30 +00:00
|
|
|
@navClick="handleNavClick(galleryIndex, 'right')" />
|
2019-01-04 13:10:41 +00:00
|
|
|
<span>{{ image.thumbUrl }}</span>
|
2019-01-09 14:12:30 +00:00
|
|
|
<span>{{ galleryIndex }}: {{ imageIndex }}</span>
|
2019-01-04 13:10:41 +00:00
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2019-01-04 16:18:45 +00:00
|
|
|
import ThumbNav from '@/components/ThumbNav'
|
|
|
|
|
2019-01-04 13:10:41 +00:00
|
|
|
export default {
|
|
|
|
components: {
|
2019-01-04 16:18:45 +00:00
|
|
|
ThumbNav
|
2019-01-04 13:10:41 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
props: {
|
|
|
|
galleries: {
|
|
|
|
type: Array,
|
|
|
|
required: true
|
2019-01-04 13:55:30 +00:00
|
|
|
},
|
|
|
|
featuredHeight: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
2019-01-09 14:12:30 +00:00
|
|
|
},
|
|
|
|
activeRow: {
|
|
|
|
type: Number,
|
|
|
|
required: true
|
2019-01-04 13:10:41 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
data () {
|
|
|
|
return {
|
2019-01-09 12:56:10 +00:00
|
|
|
thumbRowOffsets: new Array(this.galleries.length),
|
2019-01-09 14:12:30 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
|
|
|
thumbsVerticalOffset () {
|
|
|
|
let rowHeight = this.$refs.thumbContainer ? this.$refs.thumbContainer[0].clientHeight : 0;
|
|
|
|
return rowHeight * this.activeRow
|
2019-01-04 13:10:41 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2019-01-04 16:18:45 +00:00
|
|
|
mounted () {
|
2019-01-09 12:56:10 +00:00
|
|
|
this.$nextTick(function () {
|
|
|
|
this.resetOffsets()
|
|
|
|
window.addEventListener('resize', this.resetOffsets)
|
|
|
|
})
|
2019-01-04 16:18:45 +00:00
|
|
|
},
|
|
|
|
|
2019-01-04 13:10:41 +00:00
|
|
|
methods: {
|
2019-01-09 12:56:10 +00:00
|
|
|
resetOffsets() {
|
|
|
|
for (let index = 0; index < this.thumbRowOffsets.length; index++) {
|
|
|
|
this.$set(this.thumbRowOffsets, index, 0)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
handleNavClick(source, direction) {
|
|
|
|
let offset = this.thumbRowOffsets[source]
|
|
|
|
let thumbContainerWidth = this.$refs.thumbContainer[0].clientWidth
|
|
|
|
if (direction === 'left') {
|
|
|
|
offset -= thumbContainerWidth
|
|
|
|
} else if (direction === 'right') {
|
|
|
|
offset += thumbContainerWidth
|
|
|
|
}
|
|
|
|
offset = offset < 0 ? 0 : offset
|
|
|
|
this.$set(this.thumbRowOffsets, source, offset)
|
2019-01-04 15:23:13 +00:00
|
|
|
}
|
2019-01-04 13:10:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.gallery-thumbs__row {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
list-style: none;
|
|
|
|
padding: 0;
|
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
@media (max-width: $bp__layout) {
|
|
|
|
.gallery-thumbs__spacer {
|
|
|
|
display:none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.gallery-thumbs__row {
|
|
|
|
position: relative;
|
2019-01-09 12:56:10 +00:00
|
|
|
transition : transform .5s;
|
2019-01-04 13:10:41 +00:00
|
|
|
}
|
|
|
|
|
2019-01-09 12:56:10 +00:00
|
|
|
.featured-image-spacer {
|
|
|
|
position: relative;
|
|
|
|
height: calc(50vh - #{$site-menu__header-height / 2}) !important; // must override inline style set with prop
|
2019-01-04 13:10:41 +00:00
|
|
|
width: 100vw;
|
|
|
|
flex: 0 0 100vw;
|
|
|
|
}
|
|
|
|
|
|
|
|
.thumb-container {
|
2019-01-09 12:56:10 +00:00
|
|
|
position: relative;
|
|
|
|
height: calc(50vh - #{$site-menu__header-height / 2});
|
2019-01-04 16:18:45 +00:00
|
|
|
width: 100vw;
|
2019-01-04 13:10:41 +00:00
|
|
|
}
|
2019-01-09 12:56:10 +00:00
|
|
|
|
|
|
|
.thumb-nav {
|
|
|
|
position: absolute;
|
|
|
|
width: 8rem;
|
|
|
|
height: 8rem;
|
|
|
|
bottom: 1rem;
|
|
|
|
right: 1rem;
|
|
|
|
|
|
|
|
&--left {
|
|
|
|
left: 1rem;
|
|
|
|
right: auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
&--large {
|
|
|
|
width: 12rem;
|
|
|
|
height: 12rem;
|
|
|
|
}
|
|
|
|
}
|
2019-01-04 13:10:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@media (min-width: $bp__layout) {
|
|
|
|
$thumbs-height: 8rem;
|
|
|
|
|
|
|
|
.mobile-only {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
2019-01-09 12:56:10 +00:00
|
|
|
.featured-image-spacer {
|
2019-01-04 13:10:41 +00:00
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.thumb-container {
|
|
|
|
height: $thumbs-height;
|
|
|
|
}
|
|
|
|
|
2019-01-09 14:12:30 +00:00
|
|
|
.gallery__thumbs {
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
|
2019-01-04 13:55:30 +00:00
|
|
|
.gallery-thumbs__list {
|
|
|
|
height: $thumbs-height;
|
2019-01-09 14:12:30 +00:00
|
|
|
flex: 0 0 $thumbs-height;
|
2019-01-04 13:55:30 +00:00
|
|
|
|
2019-01-04 13:10:41 +00:00
|
|
|
overflow: hidden;
|
|
|
|
}
|
|
|
|
|
2019-01-09 14:12:30 +00:00
|
|
|
.gallery-thumbs__row-container {
|
|
|
|
position: relative;
|
|
|
|
|
|
|
|
transition: opacity .5s;
|
|
|
|
opacity: 0;
|
|
|
|
|
|
|
|
&.is-active {
|
|
|
|
transition: opacity .5s .3s;
|
|
|
|
opacity: 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-04 13:55:30 +00:00
|
|
|
.gallery-thumbs__row {
|
2019-01-09 14:12:30 +00:00
|
|
|
/* flex: 0 0 $thumbs-height; */
|
|
|
|
position: absolute;
|
|
|
|
height: 100%;
|
|
|
|
width: 10rem;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
2019-01-04 13:55:30 +00:00
|
|
|
}
|
2019-01-04 16:18:45 +00:00
|
|
|
|
|
|
|
.thumb-nav {
|
|
|
|
display: none;
|
|
|
|
}
|
2019-01-04 13:10:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|