SidebarMenuSkeleton.vue 863 B

1234567891011121314151617181920212223242526272829303132333435
  1. <script setup lang="ts">
  2. import type { HTMLAttributes } from "vue"
  3. import { computed } from "vue"
  4. import { cn } from '@/Packages/Shadcn/Lib/utils'
  5. import { Skeleton } from '@/Packages/Shadcn/Components/ui/skeleton'
  6. const props = defineProps<{
  7. showIcon?: boolean
  8. class?: HTMLAttributes["class"]
  9. }>()
  10. const width = computed(() => {
  11. return `${Math.floor(Math.random() * 40) + 50}%`
  12. })
  13. </script>
  14. <template>
  15. <div
  16. data-slot="sidebar-menu-skeleton"
  17. data-sidebar="menu-skeleton"
  18. :class="cn('flex h-8 items-center gap-2 rounded-md px-2', props.class)"
  19. >
  20. <Skeleton
  21. v-if="showIcon"
  22. class="size-4 rounded-md"
  23. data-sidebar="menu-skeleton-icon"
  24. />
  25. <Skeleton
  26. class="h-4 max-w-(--skeleton-width) flex-1"
  27. data-sidebar="menu-skeleton-text"
  28. :style="{ '--skeleton-width': width }"
  29. />
  30. </div>
  31. </template>