Picture.vue 1.0 KB

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