2023-07-27 14:31:52 +09:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2021-10-22 05:36:48 +09:00
|
|
|
<template>
|
2023-04-22 17:24:19 +09:00
|
|
|
<span class="ceaaebcd" :class="{ [$style.isPlus]: isPlus, [$style.isMinus]: isMinus, [$style.isZero]: isZero }">
|
2021-10-22 15:33:56 +09:00
|
|
|
<slot name="before"></slot>{{ isPlus ? '+' : '' }}{{ number(value) }}<slot name="after"></slot>
|
2021-10-22 05:36:48 +09:00
|
|
|
</span>
|
|
|
|
</template>
|
|
|
|
|
2023-04-22 17:24:19 +09:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { computed } from 'vue';
|
2023-09-19 16:37:43 +09:00
|
|
|
import number from '@/filters/number.js';
|
2021-10-22 05:36:48 +09:00
|
|
|
|
2023-04-22 17:24:19 +09:00
|
|
|
const props = defineProps<{
|
|
|
|
value: number;
|
|
|
|
}>();
|
2021-10-22 05:36:48 +09:00
|
|
|
|
2023-04-22 17:24:19 +09:00
|
|
|
const isPlus = computed(() => props.value > 0);
|
|
|
|
const isMinus = computed(() => props.value < 0);
|
|
|
|
const isZero = computed(() => props.value === 0);
|
2021-10-22 05:36:48 +09:00
|
|
|
</script>
|
|
|
|
|
2023-04-22 17:24:19 +09:00
|
|
|
<style lang="scss" module>
|
|
|
|
.isPlus {
|
|
|
|
color: var(--success);
|
|
|
|
}
|
2021-10-22 05:36:48 +09:00
|
|
|
|
2023-04-22 17:24:19 +09:00
|
|
|
.isMinus {
|
|
|
|
color: var(--error);
|
|
|
|
}
|
2021-10-22 05:36:48 +09:00
|
|
|
|
2023-04-22 17:24:19 +09:00
|
|
|
.isZero {
|
|
|
|
opacity: 0.5;
|
2021-10-22 05:36:48 +09:00
|
|
|
}
|
|
|
|
</style>
|