feat(frontend): 画像を投稿前にプレビュー可能に (#15341)
* feat(client): 画像をプレビュー可能に * Update Changelog * SPDX * 消えてたのFix * Add storybook for MkImgPreviewDialog * backgroundのスタイル変更 Co-authored-by: kakkokari-gtyih <67428053+kakkokari-gtyih@users.noreply.github.com> * Add MkImgPreviewDialog to storybook generator * Update packages/frontend/.storybook/generate.tsx --------- Co-authored-by: kakkokari-gtyih <67428053+kakkokari-gtyih@users.noreply.github.com>
This commit is contained in:
58
packages/frontend/src/components/MkImgPreviewDialog.vue
Normal file
58
packages/frontend/src/components/MkImgPreviewDialog.vue
Normal file
@@ -0,0 +1,58 @@
|
||||
<!--
|
||||
SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
SPDX-License-Identifier: AGPL-3.0-only
|
||||
-->
|
||||
|
||||
<template>
|
||||
<MkModalWindow
|
||||
ref="modal"
|
||||
:width="1800"
|
||||
:height="900"
|
||||
@close="close"
|
||||
@esc="close"
|
||||
@click="close"
|
||||
>
|
||||
<template #header>{{ file.name }}</template>
|
||||
<div :class="$style.container">
|
||||
<img :src="file.url" :alt="file.comment ?? file.name" :class="$style.img"/>
|
||||
</div>
|
||||
</MkModalWindow>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { defineProps, ref } from 'vue';
|
||||
import MkModalWindow from './MkModalWindow.vue';
|
||||
import type * as Misskey from 'misskey-js';
|
||||
|
||||
defineProps<{
|
||||
file: Misskey.entities.DriveFile;
|
||||
}>();
|
||||
|
||||
const modal = ref<typeof MkModalWindow | null>(null);
|
||||
|
||||
function close() {
|
||||
modal.value?.close();
|
||||
}
|
||||
|
||||
</script>
|
||||
<style lang="scss" module>
|
||||
.container {
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
|
||||
background-color: var(--MI_THEME-bg);
|
||||
background-size: auto auto;
|
||||
background-image: repeating-linear-gradient(135deg, transparent, transparent 6px, var(--MI_THEME-panel) 6px, var(--MI_THEME-panel) 12px);
|
||||
}
|
||||
|
||||
.img {
|
||||
width: 100%;
|
||||
max-height: 100%;
|
||||
object-fit: contain;
|
||||
}
|
||||
</style>
|
Reference in New Issue
Block a user