traxxx/assets/components/tags/photos.vue

169 lines
2.9 KiB
Vue
Raw Normal View History

2020-01-09 00:59:30 +00:00
<template>
<div class="photos">
<Campaign
:tag="tag"
:min-height="240"
:max-ratio="1.5"
class="photo-link photo"
@campaign="campaign => $emit('campaign', campaign)"
/>
<a
v-for="photo in photos"
:key="`photo-${photo.id}`"
:title="photo.comment"
:href="`/img/${photo.path}`"
target="_blank"
rel="noopener noreferrer"
class="photo-link"
>
<img
:src="getPath(photo, 'thumbnail', { local: true })"
:style="{ 'background-image': getBgPath(photo, 'lazy', { local: true }) }"
:alt="photo.comment"
:width="photo.thumbnailWidth"
:height="photo.thumbnailHeight"
class="photo"
@load="$emit('load', $event)"
>
2020-11-03 02:36:34 +00:00
2021-03-07 03:05:25 +00:00
<Logo :photo="photo" />
<router-link
v-if="photo.comment && photo.entity"
:to="`/${photo.entity.type}/${photo.entity.slug}`"
class="photo-comment"
>{{ photo.comment }} for {{ photo.entity.name }}</router-link>
<span
v-else-if="photo.comment"
2020-11-03 02:36:34 +00:00
class="photo-comment"
>{{ photo.comment }}</span>
</a>
</div>
2020-01-09 00:59:30 +00:00
</template>
<script>
2021-03-07 03:05:25 +00:00
import Logo from '../album/logo.vue';
import Campaign from '../campaigns/campaign.vue';
2021-03-07 03:05:25 +00:00
function photos() {
if (this.tag.poster && this.$store.state.ui.sfw) {
2023-07-05 22:14:38 +00:00
return [this.tag.poster].concat(this.tag.photos).map((photo) => photo.sfw);
}
2020-03-23 00:43:49 +00:00
if (this.$store.state.ui.sfw) {
2023-07-05 22:14:38 +00:00
return this.tag.photos.map((photo) => photo.sfw);
}
2020-03-23 00:43:49 +00:00
if (this.tag.poster) {
return [this.tag.poster].concat(this.tag.photos);
}
return this.tag.photos;
2020-03-23 00:43:49 +00:00
}
2020-01-09 00:59:30 +00:00
export default {
2021-03-07 03:05:25 +00:00
components: {
Logo,
Campaign,
2021-03-07 03:05:25 +00:00
},
props: {
tag: {
type: Object,
default: null,
},
},
emits: ['load', 'campaign'],
computed: {
photos,
},
2020-01-09 00:59:30 +00:00
};
</script>
<style lang="scss" scoped>
.photos {
width: 100%;
padding: .5rem 1rem;
box-sizing: border-box;
white-space: nowrap;
font-size: 0;
border-bottom: solid 1px var(--shadow-hint);
2020-01-09 00:59:30 +00:00
&::-webkit-scrollbar {
2020-01-09 00:59:30 +00:00
display: none;
}
2020-01-09 00:59:30 +00:00
&.expanded {
display: flex;
justify-content: center;
flex-wrap: wrap;
padding: 0 0 0 1rem;
.photo-link {
margin: 0 .5rem .5rem 0;
}
2020-01-09 00:59:30 +00:00
.poster,
.photo {
max-height: 18rem;
}
}
}
2020-11-03 02:36:34 +00:00
.photo-link {
display: inline-block;
position: relative;
overflow: hidden;
margin: 0 .5rem 0 0;
2020-11-03 02:36:34 +00:00
&:last-child {
margin: 0 1rem 0 0;
2020-11-03 02:36:34 +00:00
}
2021-03-07 03:05:25 +00:00
&:hover {
.photo-comment {
transform: translateY(0);
}
2021-03-07 04:11:27 +00:00
::v-deep(.album-logo) {
2021-03-07 03:05:25 +00:00
opacity: 0;
}
2020-11-03 02:36:34 +00:00
}
2020-01-09 00:59:30 +00:00
}
.poster,
.photo {
width: auto;
max-height: 15rem;
max-width: 100%;
box-shadow: 0 0 3px var(--shadow-weak);
object-fit: cover;
background-position: center;
background-size: cover;
2020-01-09 00:59:30 +00:00
}
2020-11-03 02:36:34 +00:00
.photo-comment {
width: 100%;
position: absolute;
bottom: 0;
left: 0;
box-sizing: border-box;
padding: .5rem;
color: var(--text-light);
background: var(--shadow);
font-size: .9rem;
text-shadow: 0 0 3px var(--shadow);
text-decoration: none;
2020-11-03 02:36:34 +00:00
white-space: normal;
line-height: 1.25;
transform: translateY(100%);
transition: transform .25s ease;
}
::v-deep(.campaign) .campaign-banner {
max-height: 15rem;
width: auto;
}
2020-01-09 00:59:30 +00:00
</style>