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