forked from Mirrors/elk
feat: add number animate when posts's status has changed (#244)
This commit is contained in:
parent
9e053492b5
commit
4a96d2b45a
2 changed files with 25 additions and 1 deletions
19
components/common/AnimateNumber.vue
Normal file
19
components/common/AnimateNumber.vue
Normal 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>
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue