2019-12-13 04:04:04 +00:00
|
|
|
<template>
|
|
|
|
<div
|
|
|
|
class="banner"
|
|
|
|
@wheel.prevent="scrollBanner"
|
|
|
|
>
|
|
|
|
<template v-if="release.covers && release.covers.length > 0">
|
|
|
|
<a
|
|
|
|
v-for="cover in release.covers"
|
|
|
|
:key="`cover-${cover.id}`"
|
|
|
|
:href="`/media/${cover.path}`"
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
>
|
|
|
|
<img
|
|
|
|
:src="`/media/${cover.thumbnail}`"
|
|
|
|
class="cover"
|
|
|
|
>
|
|
|
|
</a>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<div class="trailer">
|
|
|
|
<video
|
|
|
|
v-if="release.trailer"
|
|
|
|
:src="`/media/${release.trailer.path}`"
|
2019-12-13 15:59:04 +00:00
|
|
|
:poster="`/media/${(release.poster && release.poster.thumbnail)}`"
|
2019-12-13 04:04:04 +00:00
|
|
|
:alt="release.title"
|
|
|
|
class="item trailer-video"
|
|
|
|
controls
|
|
|
|
>Sorry, the tailer cannot be played in your browser</video>
|
2020-02-02 04:14:58 +00:00
|
|
|
|
|
|
|
<video
|
|
|
|
v-else-if="release.teaser && /^video\//.test(release.teaser.mime)"
|
|
|
|
:src="`/media/${release.teaser.path}`"
|
|
|
|
:poster="`/media/${(release.poster && release.poster.thumbnail)}`"
|
|
|
|
:alt="release.title"
|
|
|
|
class="item trailer-video"
|
|
|
|
controls
|
|
|
|
>Sorry, the tailer cannot be played in your browser</video>
|
|
|
|
|
|
|
|
<img
|
|
|
|
v-else-if="release.teaser && /^image\//.test(release.teaser.mime)"
|
|
|
|
:src="`/media/${release.teaser.path}`"
|
|
|
|
:alt="release.title"
|
|
|
|
class="item trailer-video"
|
|
|
|
>
|
2019-12-13 04:04:04 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<a
|
|
|
|
v-for="photo in photos"
|
|
|
|
:key="`banner-${photo.index}`"
|
|
|
|
:href="`/media/${photo.path}`"
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
>
|
|
|
|
<img
|
|
|
|
:src="`/media/${photo.thumbnail}`"
|
|
|
|
:alt="`Photo ${photo.index + 1}`"
|
|
|
|
class="item"
|
|
|
|
>
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
function photos() {
|
2019-12-13 15:59:04 +00:00
|
|
|
if (this.release.trailer) {
|
|
|
|
// poster will be on trailer video
|
|
|
|
return this.release.photos;
|
2019-12-13 04:04:04 +00:00
|
|
|
}
|
|
|
|
|
2019-12-13 15:59:04 +00:00
|
|
|
if (this.release.poster) {
|
|
|
|
return [this.release.poster].concat(this.release.photos);
|
2019-12-13 04:04:04 +00:00
|
|
|
}
|
|
|
|
|
2019-12-13 15:59:04 +00:00
|
|
|
return this.release.photos;
|
2019-12-13 04:04:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function scrollBanner(event) {
|
|
|
|
event.currentTarget.scrollLeft += event.deltaY; // eslint-disable-line no-param-reassign
|
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
release: {
|
|
|
|
type: Object,
|
|
|
|
default: null,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
photos,
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
scrollBanner,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
@import 'theme';
|
|
|
|
|
|
|
|
.banner {
|
|
|
|
background: $empty;
|
|
|
|
flex-shrink: 0;
|
|
|
|
white-space: nowrap;
|
|
|
|
overflow-x: auto;
|
|
|
|
scrollbar-width: none;
|
|
|
|
box-shadow: 0 0 3px $shadow;
|
|
|
|
font-size: 0;
|
|
|
|
|
|
|
|
&::-webkit-scrollbar {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.trailer {
|
|
|
|
display: inline-block;
|
|
|
|
max-width: 100vw;
|
|
|
|
}
|
|
|
|
|
|
|
|
.trailer-video {
|
|
|
|
max-width: 100%;
|
2020-01-07 03:23:28 +00:00
|
|
|
object-fit: cover;
|
2019-12-13 04:04:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.item {
|
|
|
|
height: 18rem;
|
|
|
|
vertical-align: middle;
|
|
|
|
}
|
|
|
|
</style>
|