CommonTicketPriorityIndicator.vue 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <!-- Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/ -->
  2. <script setup lang="ts">
  3. import { i18n } from '@shared/i18n'
  4. import { computed } from 'vue'
  5. import type { TicketPriority } from './types'
  6. interface Props {
  7. priority?: TicketPriority
  8. }
  9. const props = defineProps<Props>()
  10. const definition = computed(() => {
  11. if (!props.priority || props.priority.defaultCreate) {
  12. return null
  13. }
  14. return {
  15. class: `u-${props.priority.uiColor || 'default'}-color`,
  16. text: i18n.t(props.priority.name).toUpperCase(),
  17. }
  18. })
  19. </script>
  20. <template>
  21. <div
  22. v-if="definition"
  23. :class="[
  24. definition.class,
  25. 'h-min select-none whitespace-nowrap rounded-[4px] py-1 px-2',
  26. ]"
  27. >
  28. {{ definition.text }}
  29. </div>
  30. </template>
  31. <style scoped lang="scss">
  32. .u-default-color {
  33. @apply bg-gray/10 text-gray;
  34. }
  35. .u-high-priority-color {
  36. @apply bg-red-dark text-red-bright;
  37. }
  38. .u-low-priority-color {
  39. @apply bg-blue/10 text-blue;
  40. }
  41. .u-medium-priority-color {
  42. @apply bg-yellow/10 text-yellow;
  43. }
  44. </style>