-
-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Sorin Gitlan <[email protected]> Co-authored-by: Guillaume Chau <[email protected]>
- Loading branch information
1 parent
fb1c47f
commit 0f23b42
Showing
2 changed files
with
93 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
packages/histoire-app/src/app/components/app/HomeCounter.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<script setup lang="ts"> | ||
import { ref, toRefs } from 'vue' | ||
import { useTransition, syncRefs } from '@vueuse/core' | ||
import { Icon } from '@iconify/vue' | ||
const props = defineProps({ | ||
icon: { | ||
type: String, | ||
default: 'carbon:cube', | ||
}, | ||
title: { | ||
type: String, | ||
default: '', | ||
}, | ||
count: { | ||
type: Number, | ||
default: 0, | ||
}, | ||
}) | ||
const { count } = toRefs(props) | ||
const delayedCount = ref(0) | ||
const animatedCount = useTransition(delayedCount, { delay: 100, duration: 700 }) | ||
syncRefs(count, delayedCount) | ||
</script> | ||
|
||
<template> | ||
<div class="htw-p-2 htw-flex htw-items-center htw-gap-x-2"> | ||
<Icon | ||
:icon="props.icon" | ||
class="htw-text-2xl htw-text-gray-700 dark:htw-text-gray-300 htw-flex-none" | ||
/> | ||
<div class="htw-flex htw-flex-col htw-leading-none"> | ||
<span | ||
class="htw-text-primary-500 htw-min-w-[80px] htw-font-bold" | ||
> | ||
{{ animatedCount.toFixed() }} | ||
</span> | ||
<span | ||
class="htw-text-sm htw-text-gray-900 dark:htw-text-gray-100" | ||
> | ||
{{ title }} | ||
</span> | ||
</div> | ||
</div> | ||
</template> |