Item.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <template>
  2. <nuxt-link :to="link" class="item">
  3. <div class="item-image">
  4. <img :src="item.image.url" :alt="item.image.title" />
  5. </div>
  6. <div class="item-title" v-html="item.title"></div>
  7. <div class="item-date">{{ date }}</div>
  8. </nuxt-link>
  9. </template>
  10. <script>
  11. export default {
  12. props: {
  13. item: {
  14. type: Object,
  15. required: true,
  16. },
  17. },
  18. computed: {
  19. link() {
  20. return {
  21. name: "podcasts-category-alias",
  22. params: {
  23. category: this.item.category.alias,
  24. alias: this.item.alias,
  25. },
  26. };
  27. },
  28. date() {
  29. const options = { month: "long", day: "numeric" };
  30. const date = new Date(this.item.start_activity * 1000);
  31. return date.toLocaleDateString("ru-RU", options);
  32. },
  33. },
  34. };
  35. </script>
  36. <style lang="less" scoped>
  37. .item {
  38. aspect-ratio: 420 / 260;
  39. width: 100%;
  40. position: relative;
  41. display: flex;
  42. flex-direction: column;
  43. color: #fff;
  44. padding: 10px 25px;
  45. cursor: pointer;
  46. &-image {
  47. width: 100%;
  48. height: 100%;
  49. position: absolute;
  50. left: 0;
  51. top: 0;
  52. z-index: 0;
  53. filter: brightness(70%);
  54. transition: all 0.2s linear;
  55. img {
  56. width: 100%;
  57. height: 100%;
  58. object-fit: cover;
  59. }
  60. }
  61. &:hover &-image {
  62. filter: brightness(90%);
  63. }
  64. &-title {
  65. position: relative;
  66. z-index: 1;
  67. margin-top: auto;
  68. font-weight: bold;
  69. font-size: 24px;
  70. line-height: 120%;
  71. }
  72. &-date {
  73. margin-top: 10px;
  74. position: relative;
  75. z-index: 1;
  76. color: rgba(255, 255, 255, 0.5);
  77. }
  78. @media screen and(max-width: 1300px) {
  79. &-title {
  80. font-size: 1.8vw;
  81. }
  82. }
  83. @media screen and(max-width: 768px) {
  84. &-title {
  85. font-size: 18px;
  86. }
  87. }
  88. }
  89. </style>