173 lines
2.8 KiB
Vue
173 lines
2.8 KiB
Vue
<template>
|
|
<div class="image-viewer"
|
|
:class="{ 'is-visible': isVisible }">
|
|
<div class="viewer-background"
|
|
:style="backgroundStyle">
|
|
</div>
|
|
<div class="image-container">
|
|
<img class="image"
|
|
:src="imageUrl">
|
|
</div>
|
|
<div class="close-viewer mobile-only"
|
|
@click="$emit('close')">
|
|
X
|
|
</div>
|
|
<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')"/>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import ThumbNav from '@/components/ThumbNav'
|
|
|
|
export default {
|
|
components: {
|
|
ThumbNav
|
|
},
|
|
props: {
|
|
isVisible: {
|
|
type: Boolean,
|
|
required: true
|
|
},
|
|
imageUrl: {
|
|
type: String,
|
|
required: false,
|
|
default () {
|
|
return ''
|
|
}
|
|
},
|
|
hasNext: {
|
|
type: Boolean,
|
|
required: true
|
|
},
|
|
hasPrev: {
|
|
type: Boolean,
|
|
required: true
|
|
}
|
|
},
|
|
|
|
data () {
|
|
return {
|
|
}
|
|
},
|
|
|
|
computed: {
|
|
backgroundStyle () {
|
|
return {
|
|
backgroundImage: 'url(' + this.imageUrl + ')'
|
|
}
|
|
}
|
|
},
|
|
|
|
methods: {
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.image-viewer {
|
|
background-color: #222;
|
|
}
|
|
|
|
.image-container {
|
|
background-size: contain;
|
|
background-repeat: no-repeat;
|
|
background-color: transparent;
|
|
}
|
|
|
|
.image {
|
|
width: auto;
|
|
height: auto;
|
|
max-height: 100%;
|
|
max-width: 100%;
|
|
margin: 0 auto;
|
|
top: 50%;
|
|
transform: translateY(-50%);
|
|
}
|
|
|
|
@media (max-width: $bp__layout) {
|
|
.close-viewer {
|
|
position: absolute;
|
|
top: 0;
|
|
right: 0;
|
|
font-size: 10em;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.image-viewer {
|
|
z-index: 50;
|
|
position: relative;
|
|
|
|
transition: opacity 1s; //TEMP
|
|
opacity: 0;
|
|
pointer-events: none;
|
|
|
|
&.is-visible {
|
|
opacity: 1;
|
|
pointer-events: auto;
|
|
}
|
|
}
|
|
|
|
.image-container {
|
|
position: absolute;
|
|
width: 100%;
|
|
height: 100%;
|
|
top: 0;
|
|
left: 0;
|
|
background-position: center center;
|
|
}
|
|
|
|
.thumb-nav {
|
|
position: absolute;
|
|
width: 50%;
|
|
height: 100%;
|
|
top: 0;
|
|
|
|
&--left {
|
|
left: 0;
|
|
}
|
|
|
|
&--right {
|
|
right: 0;
|
|
}
|
|
}
|
|
}
|
|
|
|
@media (min-width: $bp__layout) {
|
|
.mobile-only {
|
|
display: none;
|
|
}
|
|
|
|
.image-viewer {
|
|
padding: 1rem 1rem 1rem 4rem;
|
|
}
|
|
|
|
.image-container {
|
|
position: absolute;
|
|
top: 8px;
|
|
left: calc(3rem + 8px);
|
|
right: 20rem;
|
|
bottom: 8px;
|
|
background-position: top center;
|
|
}
|
|
|
|
.viewer-background {
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
height: 100%;
|
|
width: 100%;
|
|
background-size: 100% 100%;
|
|
background-position: center center;
|
|
filter: blur(100px);
|
|
opacity: .3;
|
|
}
|
|
}
|
|
</style>
|