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