2023-07-27 07:31:52 +02:00
|
|
|
<!--
|
2024-02-12 03:37:45 +01:00
|
|
|
SPDX-FileCopyrightText: syuilo and misskey-project
|
2023-07-27 07:31:52 +02:00
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2021-04-24 15:38:24 +02:00
|
|
|
<template>
|
2023-04-06 01:19:49 +02:00
|
|
|
<MkA :to="`/gallery/${post.id}`" class="ttasepnz _panel" tabindex="-1" @pointerenter="enterHover" @pointerleave="leaveHover">
|
2021-04-24 15:38:24 +02:00
|
|
|
<div class="thumbnail">
|
2023-04-06 01:19:49 +02:00
|
|
|
<Transition>
|
2023-04-29 15:57:46 +02:00
|
|
|
<ImgWithBlurhash
|
|
|
|
class="img layered"
|
|
|
|
:transition="safe ? null : {
|
2023-05-19 02:44:06 +02:00
|
|
|
duration: 500,
|
2023-04-29 15:57:46 +02:00
|
|
|
leaveActiveClass: $style.transition_toggle_leaveActive,
|
|
|
|
leaveToClass: $style.transition_toggle_leaveTo,
|
|
|
|
}"
|
2024-01-30 11:53:53 +01:00
|
|
|
:src="post.files?.[0]?.thumbnailUrl"
|
|
|
|
:hash="post.files?.[0]?.blurhash"
|
2023-05-19 06:58:09 +02:00
|
|
|
:forceBlurhash="!show"
|
2023-04-29 15:57:46 +02:00
|
|
|
/>
|
2023-04-06 01:19:49 +02:00
|
|
|
</Transition>
|
2021-04-24 15:38:24 +02:00
|
|
|
</div>
|
|
|
|
<article>
|
|
|
|
<header>
|
2023-01-16 06:18:11 +01:00
|
|
|
<MkAvatar :user="post.user" class="avatar" link preview/>
|
2021-04-24 15:38:24 +02:00
|
|
|
</header>
|
|
|
|
<footer>
|
|
|
|
<span class="title">{{ post.title }}</span>
|
|
|
|
</footer>
|
|
|
|
</article>
|
|
|
|
</MkA>
|
|
|
|
</template>
|
|
|
|
|
2022-08-31 16:12:22 +02:00
|
|
|
<script lang="ts" setup>
|
2023-09-04 06:33:38 +02:00
|
|
|
import * as Misskey from 'misskey-js';
|
2023-04-06 01:19:49 +02:00
|
|
|
import { computed, ref } from 'vue';
|
2022-08-30 17:24:33 +02:00
|
|
|
import ImgWithBlurhash from '@/components/MkImgWithBlurhash.vue';
|
2023-09-19 09:37:43 +02:00
|
|
|
import { defaultStore } from '@/store.js';
|
2021-04-24 15:38:24 +02:00
|
|
|
|
2022-08-31 16:12:22 +02:00
|
|
|
const props = defineProps<{
|
2023-09-04 06:33:38 +02:00
|
|
|
post: Misskey.entities.GalleryPost;
|
2022-08-31 16:12:22 +02:00
|
|
|
}>();
|
2023-04-06 01:19:49 +02:00
|
|
|
|
|
|
|
const hover = ref(false);
|
2023-04-29 15:57:46 +02:00
|
|
|
const safe = computed(() => defaultStore.state.nsfw === 'ignore' || defaultStore.state.nsfw === 'respect' && !props.post.isSensitive);
|
|
|
|
const show = computed(() => safe.value || hover.value);
|
2023-04-06 01:19:49 +02:00
|
|
|
|
|
|
|
function enterHover(): void {
|
|
|
|
hover.value = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
function leaveHover(): void {
|
|
|
|
hover.value = false;
|
|
|
|
}
|
2021-04-24 15:38:24 +02:00
|
|
|
</script>
|
|
|
|
|
2023-04-29 15:57:46 +02:00
|
|
|
<style lang="scss" module>
|
|
|
|
.transition_toggle_leaveActive {
|
2023-05-19 02:44:06 +02:00
|
|
|
transition: opacity .5s;
|
2023-04-29 15:57:46 +02:00
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.transition_toggle_leaveTo {
|
|
|
|
opacity: 0;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
2022-12-27 10:29:39 +01:00
|
|
|
<style lang="scss" scoped>
|
2021-04-24 15:38:24 +02:00
|
|
|
.ttasepnz {
|
|
|
|
display: block;
|
|
|
|
position: relative;
|
|
|
|
height: 200px;
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
text-decoration: none;
|
|
|
|
color: var(--accent);
|
|
|
|
|
|
|
|
> .thumbnail {
|
|
|
|
transform: scale(1.1);
|
|
|
|
}
|
|
|
|
|
|
|
|
> article {
|
|
|
|
> footer {
|
|
|
|
&:before {
|
|
|
|
opacity: 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .thumbnail {
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
position: absolute;
|
2023-04-29 15:57:46 +02:00
|
|
|
transition: transform 0.5s ease;
|
2021-04-24 15:38:24 +02:00
|
|
|
|
|
|
|
> .img {
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
object-fit: cover;
|
2023-04-06 01:19:49 +02:00
|
|
|
|
|
|
|
&.layered {
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
}
|
2021-04-24 15:38:24 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> article {
|
|
|
|
position: absolute;
|
|
|
|
z-index: 1;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
|
|
|
|
> header {
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
width: 100%;
|
|
|
|
padding: 12px;
|
|
|
|
box-sizing: border-box;
|
|
|
|
display: flex;
|
|
|
|
|
|
|
|
> .avatar {
|
|
|
|
margin-left: auto;
|
|
|
|
width: 32px;
|
|
|
|
height: 32px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> footer {
|
|
|
|
position: absolute;
|
|
|
|
bottom: 0;
|
|
|
|
width: 100%;
|
|
|
|
padding: 16px;
|
|
|
|
box-sizing: border-box;
|
|
|
|
color: #fff;
|
|
|
|
text-shadow: 0 0 8px #000;
|
|
|
|
background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
|
|
|
|
|
|
|
|
&:before {
|
|
|
|
content: "";
|
|
|
|
display: block;
|
|
|
|
position: absolute;
|
|
|
|
z-index: -1;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
background: linear-gradient(rgba(0, 0, 0, 0.4), transparent);
|
|
|
|
opacity: 0;
|
|
|
|
transition: opacity 0.5s ease;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .title {
|
|
|
|
font-weight: bold;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|