Files
Caramel-CRM/resources/js/components/ui/sidebar/SidebarMenuSkeleton.vue
T

35 lines
793 B
Vue
Raw Normal View History

2025-10-20 08:57:51 +02:00
<script setup lang="ts">
2026-02-17 10:35:03 +01:00
import type { HTMLAttributes } from "vue"
import { computed } from "vue"
import { cn } from "@/lib/utils"
2025-10-20 08:57:51 +02:00
import { Skeleton } from '@/components/ui/skeleton'
const props = defineProps<{
showIcon?: boolean
2026-02-17 10:35:03 +01:00
class?: HTMLAttributes["class"]
2025-10-20 08:57:51 +02:00
}>()
const width = computed(() => {
2026-02-17 10:35:03 +01:00
return `${Math.floor(Math.random() * 40) + 50}%`
2025-10-20 08:57:51 +02:00
})
</script>
<template>
<div
data-sidebar="menu-skeleton"
2026-02-17 10:35:03 +01:00
:class="cn('rounded-md h-8 flex gap-2 px-2 items-center', props.class)"
2025-10-20 08:57:51 +02:00
>
<Skeleton
v-if="showIcon"
class="size-4 rounded-md"
data-sidebar="menu-skeleton-icon"
/>
<Skeleton
2026-02-17 10:35:03 +01:00
class="h-4 flex-1 max-w-[--skeleton-width]"
2025-10-20 08:57:51 +02:00
data-sidebar="menu-skeleton-text"
:style="{ '--skeleton-width': width }"
/>
</div>
</template>