NavigationMenuHeader.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <!-- Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ -->
  2. <script setup lang="ts">
  3. import CollapseButton from '#desktop/components/CollapseButton/CollapseButton.vue'
  4. interface Props {
  5. collapsed?: boolean
  6. title: string
  7. id: string
  8. collapsible?: boolean
  9. }
  10. defineEmits<{
  11. 'toggle-collapsed': [string]
  12. }>()
  13. withDefaults(defineProps<Props>(), {
  14. collapsed: false,
  15. })
  16. </script>
  17. <template>
  18. <!-- eslint-disable vuejs-accessibility/no-static-element-interactions-->
  19. <header
  20. class="group/heading flex cursor-default justify-between px-0 text-base font-normal leading-snug text-stone-200 active:text-stone-200 dark:text-neutral-500 dark:active:text-neutral-500"
  21. :class="{ 'cursor-pointer': collapsible }"
  22. @click="collapsible && $emit('toggle-collapsed', title)"
  23. @keydown.enter="collapsible && $emit('toggle-collapsed', title)"
  24. >
  25. <slot name="title">
  26. <h4 class="grow text-base ltr:mr-auto rtl:ml-auto">
  27. {{ $t(title) }}
  28. </h4>
  29. </slot>
  30. <CollapseButton
  31. v-if="collapsible"
  32. :is-collapsed="collapsed"
  33. :owner-id="id"
  34. group="heading"
  35. class="mt-0.5 rtl:order-1"
  36. orientation="vertical"
  37. @keydown.enter="collapsible && $emit('toggle-collapsed', title)"
  38. />
  39. </header>
  40. </template>
  41. <style scoped>
  42. header:hover :deep(.collapse-button) {
  43. @apply outline outline-1 outline-offset-1 outline-blue-600 dark:outline-blue-900;
  44. }
  45. </style>