From 2f8d02024a389181794ee9e8f2b70ffbd057cf6f Mon Sep 17 00:00:00 2001
From: taichan <40626578+tai-cha@users.noreply.github.com>
Date: Sat, 8 Feb 2025 17:33:09 +0900
Subject: feat(frontend): 画像を投稿前にプレビュー可能に (#15341)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* 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>
---
 .../frontend/src/components/MkImgPreviewDialog.vue | 58 ++++++++++++++++++++++
 1 file changed, 58 insertions(+)
 create mode 100644 packages/frontend/src/components/MkImgPreviewDialog.vue

(limited to 'packages/frontend/src/components/MkImgPreviewDialog.vue')

diff --git a/packages/frontend/src/components/MkImgPreviewDialog.vue b/packages/frontend/src/components/MkImgPreviewDialog.vue
new file mode 100644
index 0000000000..3e6e4e0ec9
--- /dev/null
+++ b/packages/frontend/src/components/MkImgPreviewDialog.vue
@@ -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>
-- 
cgit v1.2.3-freya

