traxxx/assets/components/tags/photos.vue

105 lines
2.2 KiB
Vue
Raw Normal View History

2020-01-09 00:59:30 +00:00
<template>
<div class="photos">
<ul class="nolist photos-inner">
<li>
<a
v-if="tag.poster"
2020-03-23 00:43:49 +00:00
:href="`/img/${poster.path}`"
:title="poster.comment"
2020-01-09 00:59:30 +00:00
target="_blank"
rel="noopener noreferrer"
2020-02-13 14:37:25 +00:00
class="photo-link"
2020-01-09 00:59:30 +00:00
>
<img
2020-03-23 00:43:49 +00:00
:src="`/img/${poster.thumbnail}`"
2020-01-09 00:59:30 +00:00
:alt="tag.poster.comment"
class="poster"
>
</a>
</li>
<li
2020-03-23 00:43:49 +00:00
v-for="photo in photos"
2020-01-09 00:59:30 +00:00
:key="`photo-${photo.id}`"
>
<a
:title="photo.comment"
:href="`/img/${photo.path}`"
target="_blank"
rel="noopener noreferrer"
2020-02-13 14:37:25 +00:00
class="photo-link"
2020-01-09 00:59:30 +00:00
>
<img
:src="`/img/${photo.thumbnail}`"
:alt="photo.comment"
class="photo"
>
</a>
</li>
</ul>
</div>
</template>
<script>
2020-03-23 00:43:49 +00:00
function poster() {
if (this.$store.state.ui.sfw) {
return this.tag.poster.sfw;
}
return this.tag.poster;
}
function photos() {
if (this.$store.state.ui.sfw) {
return this.tag.photos.map(photo => photo.sfw);
}
return this.tag.photos;
}
2020-01-09 00:59:30 +00:00
export default {
props: {
tag: {
type: Object,
default: null,
},
},
2020-03-23 00:43:49 +00:00
computed: {
poster,
photos,
},
2020-01-09 00:59:30 +00:00
};
</script>
<style lang="scss" scoped>
@import 'theme';
.photos {
background: $profile;
display: flex;
padding: 0 1rem;
overflow: hidden;
&.compact {
display: none;
2020-02-13 14:37:25 +00:00
padding: 0 1rem 0 1rem;
2020-01-09 00:59:30 +00:00
overflow-x: auto;
.photos-inner {
2020-02-13 14:37:25 +00:00
flex-shrink: 0;
2020-01-09 00:59:30 +00:00
}
2020-02-13 14:37:25 +00:00
.photo-link {
display: inline-block;
margin: 0 .5rem 0 0;
2020-01-09 00:59:30 +00:00
}
}
}
.poster,
.photo {
width: 100%;
margin: 0 0 .5rem 0;
}
</style>