BlueprintIcon.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <template lang='pug'>
  2. q-item-section(avatar)
  3. q-avatar.blueprint-icon(
  4. :color='avatarBgColor'
  5. :text-color='avatarTextColor'
  6. font-size='14px'
  7. rounded
  8. :style='props.hueRotate !== 0 ? `filter: hue-rotate(` + props.hueRotate + `deg)` : ``'
  9. )
  10. q-badge(
  11. v-if='indicatorDot'
  12. rounded
  13. :color='indicatorDot'
  14. floating
  15. )
  16. q-tooltip(v-if='props.indicatorText') {{props.indicatorText}}
  17. q-icon(
  18. v-if='!textMode'
  19. :name='`img:/_assets/icons/ultraviolet-` + icon + `.svg`'
  20. size='sm'
  21. )
  22. span.text-uppercase(v-else) {{props.text}}
  23. </template>
  24. <script setup>
  25. import { computed } from 'vue'
  26. import { useQuasar } from 'quasar'
  27. const props = defineProps({
  28. icon: {
  29. type: String,
  30. default: ''
  31. },
  32. dark: {
  33. type: Boolean,
  34. default: false
  35. },
  36. indicator: {
  37. type: String,
  38. default: null
  39. },
  40. indicatorText: {
  41. type: String,
  42. default: null
  43. },
  44. hueRotate: {
  45. type: Number,
  46. default: 0
  47. },
  48. text: {
  49. type: String,
  50. default: null
  51. }
  52. })
  53. // QUASAR
  54. const $q = useQuasar()
  55. // COMPUTED
  56. const textMode = computed(() => { return props.text !== null })
  57. const avatarBgColor = computed(() => { return $q.dark.isActive || props.dark ? 'dark-4' : 'blue-1' })
  58. const avatarTextColor = computed(() => { return $q.dark.isActive || props.dark ? 'white' : 'blue-7' })
  59. const indicatorDot = computed(() => {
  60. if (props.indicator === null) { return null }
  61. return (props.indicator === '') ? 'pink' : props.indicator
  62. })
  63. </script>