LayoutPublicPage.vue 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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="flex min-h-screen flex-col items-center bg-neutral-950 text-stone-200 dark:text-neutral-500"
  29. >
  30. <div :class="boxSizeClass" class="m-auto w-full">
  31. <main
  32. class="flex flex-col gap-2.5 rounded-3xl bg-white p-5 text-black dark:bg-gray-500 dark:text-white"
  33. >
  34. <div v-if="showLogo" class="flex justify-center">
  35. <CommonLogo />
  36. </div>
  37. <h1 v-if="title" class="mb-5 text-center text-xl">
  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 w-full flex-col items-center justify-center space-y-3 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="flex items-center gap-1 text-neutral-500"
  62. @focus="hoverPoweredByLogo = true"
  63. @blur="hoverPoweredByLogo = false"
  64. @mouseover="hoverPoweredByLogo = true"
  65. @mouseleave="hoverPoweredByLogo = false"
  66. >
  67. <div class="relative">
  68. <CommonIcon name="logo-flat" size="base" />
  69. <Transition name="fade">
  70. <CommonIcon
  71. v-if="hoverPoweredByLogo"
  72. class="absolute top-0"
  73. name="logo"
  74. size="base"
  75. />
  76. </Transition>
  77. </div>
  78. {{ $t('Zammad') }}
  79. </CommonLink>
  80. </footer>
  81. </div>
  82. </div>
  83. </template>