NavigationMenuList.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <!-- Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ -->
  2. <script setup lang="ts">
  3. import { computed } from 'vue'
  4. import {
  5. NavigationMenuDensity,
  6. type NavigationMenuEntry,
  7. } from '#desktop/components/NavigationMenu/types.ts'
  8. interface Props {
  9. items: NavigationMenuEntry[]
  10. density?: NavigationMenuDensity
  11. }
  12. const props = withDefaults(defineProps<Props>(), {
  13. density: NavigationMenuDensity.Comfortable,
  14. })
  15. const paddingClasses = computed(() =>
  16. props.density === NavigationMenuDensity.Dense ? 'px-2 py-1' : 'px-2 py-3',
  17. )
  18. </script>
  19. <template>
  20. <nav class="flex p-0">
  21. <ul class="m-0 flex basis-full flex-col gap-1 p-0">
  22. <li v-for="entry in items" :key="entry.label">
  23. <CommonLink
  24. class="flex gap-2 rounded-md text-sm text-gray-100 hover:bg-blue-600 hover:text-black hover:no-underline focus:outline-none focus-visible:outline-1 focus-visible:outline-offset-1 focus-visible:outline-blue-800 dark:text-neutral-400 dark:hover:bg-blue-900 dark:hover:text-white"
  25. :class="[paddingClasses]"
  26. exact-active-class="!bg-blue-800 w-full !text-white"
  27. internal
  28. :link="entry.route"
  29. >
  30. <slot v-bind="entry">
  31. <CommonLabel
  32. class="grow text-current"
  33. :prefix-icon="entry.icon"
  34. :icon-color="entry.iconColor"
  35. >
  36. {{ $t(entry.label) }}
  37. </CommonLabel>
  38. <CommonLabel
  39. v-if="typeof entry.count !== 'undefined'"
  40. class="text-black dark:text-white"
  41. >
  42. {{ entry.count }}
  43. </CommonLabel>
  44. </slot>
  45. </CommonLink>
  46. </li>
  47. </ul>
  48. </nav>
  49. </template>