ReportInfoItem.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <div class="universal-item report-info-item">
  3. <div class="item-icon">
  4. <profile-picture
  5. :avatar="createdBy.avatar"
  6. :name="createdBy.name ? createdBy.name : createdBy.username"
  7. v-if="createdBy.avatar"
  8. />
  9. <i class="material-icons" v-else>person_remove</i>
  10. </div>
  11. <div class="item-title-description">
  12. <h2 class="item-title">
  13. Reported by
  14. <router-link
  15. v-if="createdBy.username"
  16. :to="{
  17. path: `/u/${createdBy.username}`
  18. }"
  19. :title="createdBy._id"
  20. >
  21. {{ createdBy.username }}
  22. </router-link>
  23. <span v-else :title="createdBy._id">Deleted User</span>
  24. </h2>
  25. <h5 class="item-description">
  26. {{
  27. formatDistance(new Date(createdAt), new Date(), {
  28. addSuffix: true
  29. })
  30. }}
  31. </h5>
  32. </div>
  33. <div class="universal-item-actions">
  34. <slot name="actions" />
  35. </div>
  36. </div>
  37. </template>
  38. <script>
  39. import { formatDistance } from "date-fns";
  40. import ProfilePicture from "@/components/ProfilePicture.vue";
  41. export default {
  42. components: { ProfilePicture },
  43. props: {
  44. createdBy: { type: Object, default: () => {} },
  45. createdAt: { type: String, default: "" }
  46. },
  47. methods: {
  48. formatDistance
  49. }
  50. };
  51. </script>
  52. <style lang="scss" scoped>
  53. .night-mode {
  54. .report-info-item {
  55. background-color: var(--dark-grey-2) !important;
  56. border: 0 !important;
  57. }
  58. }
  59. .report-info-item {
  60. .item-icon {
  61. min-width: 45px;
  62. max-width: 45px;
  63. height: 45px;
  64. margin-right: 10px;
  65. .profile-picture,
  66. i {
  67. width: 45px;
  68. height: 45px;
  69. }
  70. i {
  71. font-size: 30px;
  72. display: flex;
  73. align-items: center;
  74. justify-content: center;
  75. }
  76. }
  77. .item-title {
  78. font-size: 14px;
  79. margin: 0;
  80. }
  81. .item-description {
  82. font-size: 12px;
  83. text-transform: capitalize;
  84. margin: 0;
  85. }
  86. }
  87. </style>