You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

109 lines
2.5 KiB

2 years ago
  1. <template>
  2. <div class="block">
  3. <v-container class="main-container">
  4. <v-row class="mx-0 mb-7 mt-4 d-flex justify-space-between pr-3">
  5. <v-card flat class="primary--text text-h4">
  6. {{ title }}
  7. </v-card>
  8. <div class="d-flex flex-row mr-5">
  9. <v-card
  10. flat
  11. class="arrow mr-10"
  12. v-if="arrow"
  13. v-show="carousel != 0"
  14. @click="leftArrowClick"
  15. >
  16. <v-img
  17. max-width="20"
  18. max-height="20"
  19. contain
  20. :src="require('@/assets/svg/left-arrow.svg')"
  21. ></v-img>
  22. </v-card>
  23. <v-card
  24. flat
  25. v-if="arrow"
  26. @click="rightArrowClick"
  27. :class="
  28. carousel == carouselPagesNum - 1 ? 'disable-arrow' : 'arrow'
  29. "
  30. >
  31. <v-img
  32. max-width="20"
  33. max-height="20"
  34. contain
  35. :src="
  36. carousel == carouselPagesNum - 1
  37. ? require('@/assets/svg/disable-right-arrow.svg')
  38. : require('@/assets/svg/right-arrow.svg')
  39. "
  40. ></v-img>
  41. </v-card>
  42. </div>
  43. </v-row>
  44. <v-row class="mx-0">
  45. <slot></slot>
  46. </v-row>
  47. </v-container>
  48. </div>
  49. </template>
  50. <script>
  51. export default {
  52. props: {
  53. title: {
  54. type: String,
  55. },
  56. arrow: {
  57. type: Boolean,
  58. },
  59. carousel: {
  60. type: Number,
  61. },
  62. carouselPagesNum: {
  63. type: Number,
  64. },
  65. },
  66. data() {
  67. return {
  68. width: undefined,
  69. };
  70. },
  71. created() {
  72. if (process.client) {
  73. this.width = window.innerWidth;
  74. }
  75. },
  76. methods: {
  77. onResize() {
  78. if (process.client) {
  79. this.width = window.innerWidth;
  80. }
  81. },
  82. rightArrowClick() {
  83. this.$emit("rightArrowOnClick", this.title);
  84. },
  85. leftArrowClick() {
  86. this.$emit("leftArrowOnClick", this.title);
  87. },
  88. },
  89. computed: {
  90. windowWidth() {
  91. if (process.client) {
  92. this.width = window.innerWidth;
  93. }
  94. return this.width;
  95. },
  96. },
  97. mounted() {
  98. this.$nextTick(() => {
  99. window.addEventListener("resize", this.onResize);
  100. });
  101. },
  102. beforeDestroy() {
  103. window.removeEventListener("resize", this.onResize);
  104. },
  105. };
  106. </script>
  107. <style lang="scss" scoped></style>