PageNavigation.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <!-- Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ -->
  2. <script setup lang="ts">
  3. import { useRouter } from 'vue-router'
  4. import { sortedFirstLevelRoutes } from '#desktop/components/PageNavigation/firstLevelRoutes.ts'
  5. import CommonButton from '../CommonButton/CommonButton.vue'
  6. interface Props {
  7. iconOnly?: boolean
  8. }
  9. //*
  10. // IMPORTANT: This is just a temporary implementations please replace and adapt it later
  11. // *//
  12. defineProps<Props>()
  13. const router = useRouter()
  14. </script>
  15. <template>
  16. <div class="py-2 pt-14">
  17. <CommonLabel
  18. v-if="!iconOnly"
  19. class="mb-2 px-2 text-neutral-500"
  20. size="small"
  21. >
  22. {{ $t('Navigation') }}
  23. </CommonLabel>
  24. <nav>
  25. <ul>
  26. <li
  27. v-for="route in sortedFirstLevelRoutes"
  28. :key="route.path"
  29. class="flex justify-center"
  30. >
  31. <CommonButton
  32. v-if="iconOnly"
  33. class="text-neutral-400 hover:outline-blue-900"
  34. :class="{
  35. '!bg-blue-800 !text-white':
  36. router.currentRoute.value.path === route.path,
  37. }"
  38. size="medium"
  39. variant="neutral"
  40. :icon="route.meta.icon"
  41. @click="router.push(route.path)"
  42. />
  43. <CommonLink
  44. v-else
  45. class="flex grow gap-2 rounded-md px-2 py-3 text-neutral-400 hover:bg-blue-900 hover:text-white hover:no-underline"
  46. :link="route.path"
  47. exact-active-class="!bg-blue-800 w-full !text-white"
  48. internal
  49. >
  50. <CommonLabel
  51. class="gap-2 text-current"
  52. :prefix-icon="route.meta.icon"
  53. >
  54. {{ $t(route.meta.title) }}
  55. </CommonLabel>
  56. </CommonLink>
  57. </li>
  58. </ul>
  59. </nav>
  60. </div>
  61. </template>