CommonLabel.vue 1017 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <!-- Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ -->
  2. <script setup lang="ts">
  3. import type { Sizes } from './types.ts'
  4. export interface Props {
  5. size?: Sizes
  6. prefixIcon?: string
  7. suffixIcon?: string
  8. }
  9. const props = withDefaults(defineProps<Props>(), {
  10. size: 'medium',
  11. })
  12. const fontSizeClassMap = {
  13. small: 'text-xs',
  14. medium: 'text-sm',
  15. large: 'text-base',
  16. xl: 'text-xl',
  17. }
  18. const iconClassMap = {
  19. small: 'xs',
  20. medium: 'tiny',
  21. large: 'small',
  22. xl: 'base',
  23. } as const
  24. </script>
  25. <template>
  26. <span
  27. class="inline-flex justify-start items-center gap-1 -:text-gray-100 -:dark:text-neutral-400"
  28. :class="fontSizeClassMap[props.size]"
  29. data-test-id="common-label"
  30. >
  31. <CommonIcon
  32. v-if="prefixIcon"
  33. :size="iconClassMap[props.size]"
  34. :name="prefixIcon"
  35. decorative
  36. />
  37. <slot />
  38. <CommonIcon
  39. v-if="suffixIcon"
  40. :size="iconClassMap[props.size]"
  41. :name="suffixIcon"
  42. decorative
  43. />
  44. </span>
  45. </template>