feat: add number animate when posts's status has changed (#244)

This commit is contained in:
Alex 2022-11-30 14:21:11 +08:00 committed by GitHub
parent 9e053492b5
commit 4a96d2b45a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 1 deletions

View file

@ -0,0 +1,19 @@
<script setup lang="ts">
defineProps<{
increased: boolean
}>()
</script>
<template>
<div overflow-hidden h="1.25rem">
<div
transition="duration-300 transform"
:style="{
transform: increased ? 'translateY(-50%)' : 'translateY(0%)',
}"
>
<slot />
<slot name="next" />
</div>
</div>
</template>

View file

@ -55,6 +55,11 @@ useCommand({
</div>
</CommonTooltip>
<span v-if="text" :class="active ? [color] : 'text-secondary-light'" text-sm>{{ text }}</span>
<CommonAnimateNumber :increased="active">
<span display-block text-secondary-light text-sm>{{ text }}</span>
<template #next>
<span display-block :class="[color]" text-sm>{{ text }}</span>
</template>
</CommonAnimateNumber>
</component>
</template>