FormFieldLink.vue 1022 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <!-- Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ -->
  2. <script setup lang="ts">
  3. import { getFieldLinkClasses } from './initializeFieldLinkClasses.ts'
  4. import type { RouteLocationRaw } from 'vue-router'
  5. withDefaults(
  6. defineProps<{
  7. id: string
  8. link: RouteLocationRaw
  9. linkIcon?: string
  10. linkLabel?: string
  11. onLinkClick?: (e: MouseEvent) => void
  12. }>(),
  13. {
  14. linkIcon: 'form-field-link',
  15. linkLabel: __('Link'),
  16. },
  17. )
  18. const classMap = getFieldLinkClasses()
  19. </script>
  20. <template>
  21. <div :class="classMap.container">
  22. <div
  23. :class="classMap.base"
  24. class="flex h-full items-center focus:outline-none"
  25. >
  26. <CommonLink
  27. v-if="link"
  28. :link="link"
  29. :class="classMap.link"
  30. :aria-label="$t(linkLabel)"
  31. class="flex items-center justify-center"
  32. open-in-new-tab
  33. @click="onLinkClick"
  34. >
  35. <CommonIcon :name="linkIcon" size="small" decorative />
  36. </CommonLink>
  37. </div>
  38. </div>
  39. </template>