PostItem.vue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <q-card class="PostItem"
  3. flat>
  4. <div class="thumbnail">
  5. <router-link :to="{name: 'Public.Post.Show', params: {id: post.id}}">
  6. <q-img :src="post.thumbnail" />
  7. </router-link>
  8. </div>
  9. <div class="texts">
  10. <div class="category-title">
  11. <router-link :to="{name: 'Public.Post.Show', params: {id: post.id}}">
  12. {{ post.category_info.title }}
  13. </router-link>
  14. </div>
  15. <div class="title ellipsis-2-lines">
  16. <router-link :to="{name: 'Public.Post.Show', params: {id: post.id}}">
  17. {{ post.title }}
  18. </router-link>
  19. </div>
  20. <div class="published-date">
  21. تاریخ انتشار
  22. {{ miladiToShamsi(post.creation_time) }}
  23. </div>
  24. </div>
  25. </q-card>
  26. </template>
  27. <script>
  28. import { Post } from 'src/models/Post.js'
  29. import Assist from 'src/assets/js/Assist.js'
  30. export default {
  31. name: 'PostItem',
  32. props: {
  33. post: {
  34. type: Post,
  35. default: new Post()
  36. }
  37. },
  38. methods: {
  39. miladiToShamsi (date) {
  40. return Assist.miladiToShamsi(date, 'jDD jMMM jYYYY')
  41. }
  42. }
  43. }
  44. </script>
  45. <style lang="scss" scoped>
  46. .PostItem {
  47. display: flex;
  48. flex-flow: row;
  49. justify-content: flex-start;
  50. border: 2px solid transparent;
  51. padding: 16px;
  52. &:hover {
  53. border-radius: 14px;
  54. border-color: #0B6AB1;
  55. }
  56. .thumbnail {
  57. width: 148px;
  58. .q-img {
  59. width: 100%;
  60. }
  61. }
  62. .texts {
  63. width: calc(100% - 148px);
  64. position: relative;
  65. padding-left: 14px;
  66. .category-title {
  67. width: max-content;
  68. border-radius: 3px;
  69. background: #E3E7F4;
  70. padding: 4px 8px;
  71. color: #666;
  72. font-size: 14px;
  73. font-weight: 500;
  74. line-height: 100%;
  75. margin-bottom: 8px;
  76. }
  77. .title {
  78. width: 100%;
  79. color: #000;
  80. text-align: left;
  81. font-size: 18px;
  82. font-weight: 700;
  83. }
  84. .published-date {
  85. color: #000;
  86. text-align: right;
  87. font-size: 14px;
  88. font-weight: 200;
  89. position: absolute;
  90. left: 14px;
  91. bottom: 0;
  92. }
  93. }
  94. }
  95. </style>