summaryrefslogtreecommitdiff
path: root/packages/frontend/src/components/MkInfo.vue
blob: bdc38f51422099324d02b2c66aa2bf28e1686b0f (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
<!--
SPDX-FileCopyrightText: syuilo and misskey-project
SPDX-License-Identifier: AGPL-3.0-only
-->

<template>
<div :class="[$style.root, { [$style.warn]: warn }]">
	<i v-if="warn" class="ti ti-alert-triangle" :class="$style.i"></i>
	<i v-else class="ti ti-info-circle" :class="$style.i"></i>
	<div><slot></slot></div>
	<button v-if="closable" :class="$style.button" class="_button" @click="close()"><i class="ti ti-x"></i></button>
</div>
</template>

<script lang="ts" setup>
import { } from 'vue';

const props = defineProps<{
	warn?: boolean;
	closable?: boolean;
}>();

const emit = defineEmits<{
	(ev: 'close'): void;
}>();

function close() {
	// こいつの中では非表示動作は行わない
	emit('close');
}
</script>

<style lang="scss" module>
.root {
	display: flex;
  align-items: center;
	padding: 12px 14px;
	font-size: 90%;
	background: color-mix(in srgb, var(--MI_THEME-infoBg) 65%, transparent);
	color: var(--MI_THEME-infoFg);
	border-radius: var(--MI-radius);
	white-space: pre-wrap;
	z-index: 1;

	&.warn {
		background: color-mix(in srgb, var(--MI_THEME-infoWarnBg) 65%, transparent);
		color: var(--MI_THEME-infoWarnFg);
	}
}

.i {
	margin-right: 4px;
}

.button {
	margin-left: auto;
	padding: 4px;
}
</style>