summaryrefslogtreecommitdiff
path: root/packages/frontend-embed/src/components/EmMediaVideo.vue
blob: e2779bdee4e6ff4786ec94bdd34eba28d8d67ddb (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<!--
SPDX-FileCopyrightText: syuilo and misskey-project
SPDX-License-Identifier: AGPL-3.0-only
-->

<template>
<a :href="href" target="_blank" :class="$style.root">
	<img v-if="!video.isSensitive && video.thumbnailUrl" :class="$style.thumbnail" :src="video.thumbnailUrl">
	<div :class="$style.videoOverlayPlayButton"><i class="ti ti-player-play-filled"></i></div>
</a>
</template>

<script setup lang="ts">
import * as Misskey from 'misskey-js';

defineProps<{
	video: Misskey.entities.DriveFile;
	href: string;
}>();
</script>

<style lang="scss" module>
.root {
	position: relative;
	box-sizing: border-box;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	padding: var(--MI-margin);
	border: 1px solid var(--MI_THEME-divider);
	border-radius: var(--MI-radius);
	background-color: #000;

	&:hover {
		text-decoration: none;
	}
}

.thumbnail {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.videoOverlayPlayButton {
	background: var(--MI_THEME-accent);
	color: #fff;
	padding: 1rem;
	border-radius: 99rem;

	font-size: 1rem;
	line-height: 1rem;

	&:focus-visible {
		outline: none;
	}
}
</style>