summaryrefslogtreecommitdiff
path: root/packages/frontend/src/components/page/page.image.vue
blob: 7e8d8f7bfb4a94ad3baadddf6de8ea9c6ec9cebe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<!--
SPDX-FileCopyrightText: syuilo and misskey-project
SPDX-License-Identifier: AGPL-3.0-only
-->

<template>
<div :class="$style.root">
	<MkMediaList v-if="image" :mediaList="[image]" :class="$style.mediaList"/>
</div>
</template>

<script lang="ts" setup>
import { onMounted, ref } from 'vue';
import * as Misskey from 'misskey-js';
import MkMediaList from '@/components/MkMediaList.vue';

const props = defineProps<{
	block: Extract<Misskey.entities.PageBlock, { type: 'image' }>,
	page: Misskey.entities.Page,
}>();

const image = ref<Misskey.entities.DriveFile | null>(null);

onMounted(() => {
	image.value = props.page.attachedFiles.find(x => x.id === props.block.fileId) ?? null;
});
</script>

<style lang="scss" module>
.root {
	border: 1px solid var(--MI_THEME-divider);
	border-radius: var(--MI-radius);
	overflow: hidden;
}
.mediaList {
	// MkMediaList 内の上部マージン 4px
	margin-top: -4px;
	height: calc(100% + 4px);
}
</style>