2019-01-04 14:34:32 +00:00
|
|
|
<template>
|
|
|
|
<div class="image-viewer"
|
2019-01-09 21:23:03 +00:00
|
|
|
:class="{ 'is-visible': isVisible }"
|
|
|
|
:style="imageViewerStyle">
|
2019-01-10 13:28:35 +00:00
|
|
|
<div class="close-viewer mobile-only"
|
2019-01-04 14:34:32 +00:00
|
|
|
@click="$emit('close')">
|
|
|
|
X
|
|
|
|
</div>
|
2019-01-10 13:28:35 +00:00
|
|
|
<ThumbNav v-if="hasPrev"
|
|
|
|
class="thumb-nav thumb-nav--left mobile-only"
|
|
|
|
direction="left"
|
|
|
|
@navClick="$emit('clickPrev')"/>
|
|
|
|
<ThumbNav v-if="hasNext"
|
|
|
|
class="thumb-nav thumb-nav--right mobile-only"
|
|
|
|
direction="right"
|
|
|
|
@navClick="$emit('clickNext')"/>
|
2019-01-04 14:34:32 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2019-01-10 13:28:35 +00:00
|
|
|
import ThumbNav from '@/components/ThumbNav'
|
|
|
|
|
2019-01-04 14:34:32 +00:00
|
|
|
export default {
|
2019-01-10 13:28:35 +00:00
|
|
|
components: {
|
|
|
|
ThumbNav
|
|
|
|
},
|
2019-01-04 14:34:32 +00:00
|
|
|
props: {
|
|
|
|
isVisible: {
|
|
|
|
type: Boolean,
|
|
|
|
required: true
|
2019-01-09 21:23:03 +00:00
|
|
|
},
|
|
|
|
imageUrl: {
|
|
|
|
type: String,
|
|
|
|
required: false,
|
|
|
|
default () {
|
|
|
|
return ''
|
|
|
|
}
|
2019-01-10 13:28:35 +00:00
|
|
|
},
|
|
|
|
hasNext: {
|
|
|
|
type: Boolean,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
hasPrev: {
|
|
|
|
type: Boolean,
|
|
|
|
required: true
|
2019-01-04 14:34:32 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2019-01-09 21:23:03 +00:00
|
|
|
computed: {
|
|
|
|
imageViewerStyle () {
|
|
|
|
return {
|
|
|
|
backgroundImage: 'url(' + this.imageUrl + ')'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2019-01-04 14:34:32 +00:00
|
|
|
methods: {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.image-viewer {
|
2019-01-10 13:28:35 +00:00
|
|
|
background-size: contain;
|
|
|
|
background-repeat: no-repeat;
|
2019-01-09 21:23:03 +00:00
|
|
|
background-position: center center;
|
2019-01-10 13:28:35 +00:00
|
|
|
background-color: #333;
|
2019-01-04 14:34:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@media (max-width: $bp__layout) {
|
|
|
|
.close-viewer {
|
|
|
|
font-size: 10em;
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
|
|
|
|
.image-viewer {
|
|
|
|
z-index: 50;
|
|
|
|
|
|
|
|
transition: opacity 1s; //TEMP
|
|
|
|
opacity: 0;
|
|
|
|
pointer-events: none;
|
|
|
|
|
|
|
|
&.is-visible {
|
|
|
|
opacity: 1;
|
|
|
|
pointer-events: auto;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-01-09 21:23:03 +00:00
|
|
|
|
|
|
|
@media (min-width: $bp__layout) {
|
2019-01-10 13:28:35 +00:00
|
|
|
.mobile-only {
|
2019-01-09 21:23:03 +00:00
|
|
|
display: none;
|
|
|
|
}
|
2019-01-10 13:28:35 +00:00
|
|
|
|
|
|
|
.image-viewer {
|
|
|
|
background-size: cover;
|
|
|
|
}
|
2019-01-09 21:23:03 +00:00
|
|
|
}
|
2019-01-04 14:34:32 +00:00
|
|
|
</style>
|