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

<template>
<div v-if="form.modified.value" :class="$style.root">
	<div :class="$style.text">{{ i18n.tsx.thereAreNChanges({ n: form.modifiedCount.value }) }}</div>
	<div style="margin-left: auto;" class="_buttons">
		<MkButton danger rounded @click="form.discard"><i class="ti ti-x"></i> {{ i18n.ts.discard }}</MkButton>
		<MkButton primary rounded :disabled="!canSaving" @click="form.save"><i class="ti ti-check"></i> {{ i18n.ts.save }}</MkButton>
	</div>
</div>
</template>

<script lang="ts" setup>
import { } from 'vue';
import MkButton from './MkButton.vue';
import type { useForm } from '@/composables/use-form.js';
import { i18n } from '@/i18n.js';

const props = withDefaults(defineProps<{
	form: ReturnType<typeof useForm>;
	canSaving?: boolean;
}>(), {
	canSaving: true,
});
</script>

<style lang="scss" module>
.root {
	display: flex;
	align-items: center;
}

.text {
	color: var(--MI_THEME-warn);
	font-size: 90%;
	animation: modified-blink 2s infinite;
}

@keyframes modified-blink {
	0% { opacity: 1; }
	50% { opacity: 0.5; }
	100% { opacity: 1; }
}
</style>