LayoutMain.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <!-- Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ -->
  2. <script setup lang="ts">
  3. import { computed, ref, unref } from 'vue'
  4. import { useRoute } from 'vue-router'
  5. // import TransitionViewNavigation from '../transition/TransitionViewNavigation/TransitionViewNavigation.vue'
  6. import { useStickyHeader } from '#shared/composables/useStickyHeader.ts'
  7. import { headerOptions as header } from '#mobile/composables/useHeader.ts'
  8. import LayoutBottomNavigation from './LayoutBottomNavigation.vue'
  9. import LayoutHeader from './LayoutHeader.vue'
  10. const route = useRoute()
  11. const title = computed(() => {
  12. return unref(header.value.title) || route.meta.title
  13. })
  14. const showBottomNavigation = computed(() => {
  15. return route.meta.hasBottomNavigation
  16. })
  17. const showHeader = computed(() => {
  18. return route.meta.hasHeader
  19. })
  20. const headerComponent = ref<{ headerElement: HTMLElement }>()
  21. const headerElement = computed(() => {
  22. return headerComponent.value?.headerElement
  23. })
  24. const { stickyStyles } = useStickyHeader([title], headerElement)
  25. </script>
  26. <template>
  27. <div class="flex h-full flex-col">
  28. <LayoutHeader
  29. v-if="showHeader"
  30. ref="headerComponent"
  31. v-bind="header"
  32. :title="title"
  33. :style="stickyStyles.header"
  34. />
  35. <main
  36. class="flex h-full flex-col"
  37. :style="showHeader ? stickyStyles.body : {}"
  38. >
  39. <!-- let's see how it feels without transition -->
  40. <RouterView />
  41. <div v-if="showBottomNavigation" class="BottomNavigationPadding"></div>
  42. </main>
  43. <LayoutBottomNavigation v-if="showBottomNavigation" />
  44. </div>
  45. </template>
  46. <style scoped>
  47. .BottomNavigationPadding {
  48. @apply w-full shrink-0;
  49. height: calc(var(--safe-bottom, 0) + theme('height.14'));
  50. }
  51. </style>