workbench-quick-nav.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <script setup lang="ts">
  2. import type { WorkbenchQuickNavItem } from '../typing';
  3. import {
  4. Card,
  5. CardContent,
  6. CardHeader,
  7. CardTitle,
  8. VbenIcon,
  9. } from '@vben-core/shadcn-ui';
  10. interface Props {
  11. items: WorkbenchQuickNavItem[];
  12. title: string;
  13. }
  14. defineOptions({
  15. name: 'WorkbenchQuickNav',
  16. });
  17. withDefaults(defineProps<Props>(), {
  18. items: () => [],
  19. });
  20. </script>
  21. <template>
  22. <Card>
  23. <CardHeader class="py-4">
  24. <CardTitle class="text-lg">{{ title }}</CardTitle>
  25. </CardHeader>
  26. <CardContent class="flex flex-wrap p-0">
  27. <template v-for="(item, index) in items" :key="item.title">
  28. <div
  29. :class="{
  30. 'border-r-0': index % 3 === 2,
  31. 'pb-4': index > 2,
  32. 'border-b-0': index < 3,
  33. }"
  34. class="flex-col-center border-border group w-1/3 cursor-pointer border-b border-r border-t py-8 hover:shadow-xl"
  35. >
  36. <VbenIcon
  37. :color="item.color"
  38. :icon="item.icon"
  39. class="size-7 transition-all duration-300 group-hover:scale-125"
  40. />
  41. <span class="text-md mt-2 truncate">{{ item.title }}</span>
  42. </div>
  43. </template>
  44. </CardContent>
  45. </Card>
  46. </template>