Files
boursecu_admin/src/pages/dashboard/components/dashboardItem.vue
T

55 lines
1.7 KiB
Vue

<template>
<div class="w-full min-w-0 rounded-lg border border-gray-100 bg-gray-50/60 px-3 py-2 lg:border-0 lg:bg-transparent lg:px-0 lg:py-0">
<div class="flex w-full min-w-0 items-center justify-between gap-2 lg:block">
<div class="flex min-w-0 items-center gap-2">
<div class="aspect-square h-8 shrink-0 rounded-full p-1" :class="bgColor">
<BaseIcon icon="vuesax-linear:profile-add" :class="textColor" />
</div>
<div class="truncate text-xs font-bold">{{ title }}</div>
</div>
<div class="flex shrink-0 flex-row-reverse items-baseline gap-1 pl-1 lg:mt-5 lg:w-full lg:pl-2">
<div class="text-xs">{{ unit }}</div>
<div class="font-bold text-lg lg:text-xl">{{ count ?? 0 }}</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
interface Prop {
color: string
title: string
count?: number
unit: 'نفر' | 'کیلوگرم' | 'گرم'
}
const props = defineProps<Prop>()
const bgColor = computed(() => {
switch (props.color) {
case 'fuchsia':
return 'bg-fuchsia-100 dark:bg-fuchsia-500/20'
case 'orange':
return 'bg-orange-100 dark:bg-orange-500/20'
case 'green':
return 'bg-green-100 dark:bg-green-500/20'
case 'blue':
return 'bg-blue-100 dark:bg-blue-500/20'
}
})
const textColor = computed(() => {
switch (props.color) {
case 'fuchsia':
return 'text-fuchsia-600 dark:text-fuchsia-300'
case 'orange':
return 'text-orange-600 dark:text-orange-300'
case 'green':
return 'text-green-600 dark:text-green-300'
case 'blue':
return 'text-blue-600 dark:text-blue-300'
}
})
</script>
<style scoped lang="less"></style>