Picture.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <template>
  2. <div class="cursor-pointer flex h-5 w-5 relative items-center justify-center">
  3. <img
  4. class="
  5. bg-primaryDark bg-primaryLight
  6. rounded-full
  7. object-cover object-center
  8. h-5
  9. transition
  10. w-5
  11. absolute
  12. "
  13. :src="url"
  14. :alt="alt"
  15. loading="lazy"
  16. />
  17. <div class="rounded-full shadow-inner inset-0 absolute"></div>
  18. <span
  19. v-if="indicator"
  20. class="
  21. border-primary
  22. rounded-full
  23. border-2
  24. h-2.5
  25. -top-0.5
  26. -right-0.5
  27. w-2.5
  28. absolute
  29. "
  30. :class="indicatorStyles"
  31. ></span>
  32. </div>
  33. </template>
  34. <script>
  35. import { defineComponent } from "@nuxtjs/composition-api"
  36. export default defineComponent({
  37. props: {
  38. url: {
  39. type: String,
  40. default: `https://avatars.dicebear.com/v2/avataaars/${Math.random()
  41. .toString(36)
  42. .substring(7)}.svg?mood[]=happy`,
  43. },
  44. alt: {
  45. type: String,
  46. default: "Profile picture",
  47. },
  48. indicator: {
  49. type: Boolean,
  50. default: false,
  51. },
  52. indicatorStyles: {
  53. type: String,
  54. default: "bg-green-500",
  55. },
  56. },
  57. })
  58. </script>