From e461fb169ef56a5878dabf05806c137b8309f3d2 Mon Sep 17 00:00:00 2001
From: syuilo <Syuilotan@yahoo.co.jp>
Date: Sat, 22 Apr 2023 17:24:19 +0900
Subject: refactor(frontend): refactor MkNumberDiff.vue

---
 packages/frontend/src/components/MkNumberDiff.vue | 51 ++++++++---------------
 1 file changed, 18 insertions(+), 33 deletions(-)

(limited to 'packages/frontend/src/components/MkNumberDiff.vue')

diff --git a/packages/frontend/src/components/MkNumberDiff.vue b/packages/frontend/src/components/MkNumberDiff.vue
index e7d4a5472a..303417dae8 100644
--- a/packages/frontend/src/components/MkNumberDiff.vue
+++ b/packages/frontend/src/components/MkNumberDiff.vue
@@ -1,47 +1,32 @@
 <template>
-<span class="ceaaebcd" :class="{ isPlus, isMinus, isZero }">
+<span class="ceaaebcd" :class="{ [$style.isPlus]: isPlus, [$style.isMinus]: isMinus, [$style.isZero]: isZero }">
 	<slot name="before"></slot>{{ isPlus ? '+' : '' }}{{ number(value) }}<slot name="after"></slot>
 </span>
 </template>
 
-<script lang="ts">
-import { computed, defineComponent } from 'vue';
+<script lang="ts" setup>
+import { computed } from 'vue';
 import number from '@/filters/number';
 
-export default defineComponent({
-	props: {
-		value: {
-			type: Number,
-			required: true,
-		},
-	},
+const props = defineProps<{
+	value: number;
+}>();
 
-	setup(props) {
-		const isPlus = computed(() => props.value > 0);
-		const isMinus = computed(() => props.value < 0);
-		const isZero = computed(() => props.value === 0);
-		return {
-			isPlus,
-			isMinus,
-			isZero,
-			number,
-		};
-	},
-});
+const isPlus = computed(() => props.value > 0);
+const isMinus = computed(() => props.value < 0);
+const isZero = computed(() => props.value === 0);
 </script>
 
-<style lang="scss" scoped>
-.ceaaebcd {
-	&.isPlus {
-		color: var(--success);
-	}
+<style lang="scss" module>
+.isPlus {
+	color: var(--success);
+}
 
-	&.isMinus {
-		color: var(--error);
-	}
+.isMinus {
+	color: var(--error);
+}
 
-	&.isZero {
-		opacity: 0.5;
-	}
+.isZero {
+	opacity: 0.5;
 }
 </style>
-- 
cgit v1.2.3-freya

