LayoutPublicPage.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <!-- Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ -->
  2. <script setup lang="ts">
  3. import { ref, computed } from 'vue'
  4. import CommonLogo from '#shared/components/CommonLogo/CommonLogo.vue'
  5. import LayoutPublicPageBoxActions from './LayoutPublicPageBoxActions.vue'
  6. import type { BoxSizes } from '../types'
  7. export interface Props {
  8. title?: string
  9. showLogo?: boolean
  10. boxSize?: BoxSizes
  11. hideFooter?: boolean
  12. }
  13. const props = withDefaults(defineProps<Props>(), {
  14. boxSize: 'medium',
  15. })
  16. const boxSizeMap: Record<BoxSizes, string> = {
  17. small: 'max-w-md',
  18. medium: 'max-w-lg',
  19. large: 'max-w-2xl',
  20. }
  21. const boxSizeClass = computed(() => {
  22. return boxSizeMap[props.boxSize]
  23. })
  24. const hoverPoweredByLogo = ref(false)
  25. </script>
  26. <template>
  27. <div
  28. class="min-h-screen flex flex-col items-center bg-neutral-950 text-stone-200 dark:text-neutral-500"
  29. >
  30. <div :class="boxSizeClass" class="w-full m-auto">
  31. <main
  32. class="flex flex-col gap-2.5 p-5 bg-white dark:bg-gray-500 text-black dark:text-white rounded-3xl"
  33. >
  34. <div v-if="showLogo" class="flex justify-center">
  35. <CommonLogo />
  36. </div>
  37. <h1 v-if="title" class="mb-5 text-xl text-center">
  38. {{ $t(title) }}
  39. </h1>
  40. <slot />
  41. <LayoutPublicPageBoxActions v-if="$slots.boxActions">
  42. <slot name="boxActions" />
  43. </LayoutPublicPageBoxActions>
  44. </main>
  45. <section
  46. v-if="$slots.bottomContent"
  47. :aria-label="$t('Additional information and links')"
  48. class="flex flex-col space-y-3 w-full items-center justify-center py-3 align-middle text-xs"
  49. >
  50. <slot name="bottomContent" />
  51. </section>
  52. <footer
  53. v-if="!hideFooter"
  54. class="flex w-full items-center justify-center py-3 align-middle text-xs"
  55. >
  56. <span class="ltr:mr-1 rtl:ml-1">{{ $t('Powered by') }}</span>
  57. <CommonLink
  58. link="https://zammad.org"
  59. open-in-new-tab
  60. external
  61. class="text-neutral-500 flex items-center gap-1"
  62. @mouseover="hoverPoweredByLogo = true"
  63. @mouseleave="hoverPoweredByLogo = false"
  64. >
  65. <div class="relative">
  66. <CommonIcon name="logo-flat" size="base" />
  67. <Transition name="fade">
  68. <CommonIcon
  69. v-if="hoverPoweredByLogo"
  70. class="absolute top-0"
  71. name="logo"
  72. size="base"
  73. />
  74. </Transition>
  75. </div>
  76. {{ $t('Zammad') }}
  77. </CommonLink>
  78. </footer>
  79. </div>
  80. </div>
  81. </template>
  82. <style>
  83. .fade-enter-active,
  84. .fade-leave-active {
  85. transition: opacity 0.3s ease;
  86. }
  87. .fade-enter-from,
  88. .fade-leave-to {
  89. opacity: 0;
  90. }
  91. </style>