LayoutHeader.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <!-- Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/ -->
  2. <script setup lang="ts">
  3. import type { RouteLocationRaw } from 'vue-router'
  4. import CommonBackButton from '../CommonBackButton/CommonBackButton.vue'
  5. export interface Props {
  6. title?: string
  7. titleClass?: string
  8. backTitle?: string
  9. backUrl?: RouteLocationRaw
  10. actionTitle?: string
  11. onAction?(): void
  12. }
  13. defineProps<Props>()
  14. </script>
  15. <template>
  16. <header
  17. v-if="title || backUrl || (onAction && actionTitle)"
  18. class="grid h-[64px] grid-cols-3 border-b-[0.5px] border-white/10 px-4"
  19. data-test-id="appHeader"
  20. >
  21. <div class="flex items-center justify-self-start text-base">
  22. <CommonBackButton v-if="backUrl" :fallback="backUrl" :label="backTitle" />
  23. </div>
  24. <div
  25. :class="[
  26. 'flex flex-1 items-center justify-center text-center text-lg font-bold',
  27. titleClass,
  28. ]"
  29. >
  30. {{ $t(title) }}
  31. </div>
  32. <div class="flex cursor-pointer items-center justify-self-end text-base">
  33. <button
  34. v-if="onAction && actionTitle"
  35. class="text-blue"
  36. @click="onAction?.()"
  37. >
  38. {{ $t(actionTitle) }}
  39. </button>
  40. </div>
  41. </header>
  42. </template>