ProfileSearchResult.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <script>
  2. import { defineComponent } from 'vue'
  3. import { config } from '@/main.js'
  4. import { useRouter } from 'vue-router'
  5. import Checkmark2Icon from '@/components/icons/Checkmark2.vue'
  6. export default defineComponent({
  7. name: 'ProfileSearchResult',
  8. components: { Checkmark2Icon },
  9. computed: {
  10. config() {
  11. return config
  12. },
  13. },
  14. props: {
  15. id: {
  16. type: String, // this is incase id = "myself"
  17. required: true,
  18. },
  19. username: {
  20. type: String,
  21. required: true,
  22. },
  23. following: {
  24. type: Number,
  25. required: true,
  26. },
  27. followers: {
  28. type: Number,
  29. required: true,
  30. },
  31. socialCredit: {
  32. type: Number,
  33. required: true,
  34. },
  35. verified: {
  36. type: Boolean,
  37. required: true
  38. }
  39. },
  40. setup() {
  41. const router = useRouter();
  42. return {router}
  43. }
  44. })
  45. </script>
  46. <template>
  47. <div class="search-result flex-row" @click="this.router.push(`/profile/${id}`)">
  48. <img :src="`${config.serverURL}/account/${id}/picture`" alt="profile picture" class="profile-picture" />
  49. <div class="flex-column">
  50. <div class="flex-row">
  51. <h2>{{ username }}</h2>
  52. <Checkmark2Icon v-if="verified" class="checkmark" />
  53. </div>
  54. <div class="flex-row">
  55. <span class="flex-row">
  56. <span>{{ followers }}</span>
  57. <p class="dark">followers</p>
  58. </span>
  59. <span class="flex-row">
  60. <span>{{ following }}</span>
  61. <p class="dark">following</p>
  62. </span>
  63. <span class="flex-row">
  64. <span>{{ socialCredit }}</span>
  65. <p class="dark">social credit</p>
  66. </span>
  67. </div>
  68. </div>
  69. </div>
  70. </template>
  71. <style scoped>
  72. .search-result:hover {
  73. animation-name: interaction;
  74. animation-duration: 0.5s;
  75. animation-iteration-count: infinite;
  76. cursor: pointer;
  77. }
  78. .profile-picture {
  79. width: 100px;
  80. height: 100px;
  81. border-radius: 100%;
  82. }
  83. .flex-row {
  84. display: flex;
  85. flex-direction: row;
  86. justify-content: center;
  87. align-items: center;
  88. gap: 10px;
  89. }
  90. .flex-column {
  91. display: flex;
  92. flex-direction: column;
  93. justify-content: center;
  94. align-items: center;
  95. gap: 10px;
  96. }
  97. .checkmark {
  98. width: 50px;
  99. height: 40px;
  100. }
  101. .dark {
  102. color: var(--secondary-background-color);
  103. }
  104. </style>