CommonOrganizationAvatar.vue 978 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <!-- Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ -->
  2. <script setup lang="ts">
  3. import { computed } from 'vue'
  4. import { getOrganizationAvatarClasses } from '#shared/initializer/initializeOrganizationAvatarClasses.ts'
  5. import CommonAvatar from '../CommonAvatar/CommonAvatar.vue'
  6. import type { AvatarOrganization } from './types.ts'
  7. import type { AvatarSize } from '../CommonAvatar/index.ts'
  8. export interface Props {
  9. entity: AvatarOrganization
  10. size?: AvatarSize
  11. }
  12. const props = defineProps<Props>()
  13. const icon = computed(() => {
  14. return props.entity.active ? 'organization' : 'inactive-organization'
  15. })
  16. const { base, inactive } = getOrganizationAvatarClasses()
  17. </script>
  18. <template>
  19. <CommonAvatar
  20. :class="[
  21. base,
  22. {
  23. [inactive]: !entity.active,
  24. },
  25. ]"
  26. :size="size"
  27. :icon="icon"
  28. :aria-label="`Avatar (${entity.name})`"
  29. :vip-icon="entity.vip ? 'vip-organization' : undefined"
  30. />
  31. </template>