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.

120 lines
2.7 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div
  3. class="sort xl:tw-px-[35px] xl:tw-py-[30px] xl:tw-border-solid xl:tw-border xl:tw-border-neutrals-200 xl:tw-rounded-[30px]">
  4. <!-- tw-mb-[26px] xl:tw-mb-[30px] -->
  5. <div class="">
  6. <span class="t20 tw-text-primary-1">{{ results
  7. }}<span class="tw-body-3 tw-ml-[10px] tw-text-[#757575]">{{
  8. $t("Results")
  9. }}</span></span>
  10. </div>
  11. <div class="tw-hidden xl:tw-block">
  12. <div class="tw-flex tw-justify-items-start tw-gap-[50px] tw-pt-[20px]">
  13. <div class="tw-body-3">
  14. {{ $t("Sort By") }}
  15. </div>
  16. <div class="tw-body-3">
  17. |
  18. </div>
  19. <div class="" v-for="(item, index) in sortType" :key="index">
  20. <button :for="item.value" class="tw-body-3 tw-text-base-secondary focus:tw-text-primary-1" @click="onClick(item)">
  21. {{ $t(item.name) }}
  22. </button>
  23. </div>
  24. </div>
  25. </div>
  26. <div class="element tw-flex tw-justify-between tw-items-cente xl:tw-hidden">
  27. <button class="btn-filter tw-text-transparent" @click="$emit('filter', true)">
  28. filter
  29. </button>
  30. <select class="tw-py-[9px] tw-rounded-[10px]" name="sort_by" v-model="sort" @change="onChnage()">
  31. <option value="0">{{ $t("Select option") }}</option>
  32. <option v-for="item in sortType" :key=item.value :value="item.value">
  33. {{ $t(item.name) }}
  34. </option>
  35. </select>
  36. </div>
  37. </div>
  38. </template>
  39. <script>
  40. export default {
  41. props: {
  42. results: {
  43. type: Number,
  44. },
  45. sortType: {
  46. type: Array,
  47. },
  48. sortBy: {
  49. type: String,
  50. },
  51. },
  52. data() {
  53. return {
  54. sort: this.sortBy ? this.sortBy : "0",
  55. options: {}
  56. };
  57. },
  58. watch: {
  59. sortBy: {
  60. handler: function () {
  61. this.sort = this.sortBy;
  62. },
  63. },
  64. sort: {
  65. handler: function () {
  66. this.$emit("sort", this.sort);
  67. },
  68. },
  69. },
  70. methods: {
  71. onClick(item) {
  72. this.sort = item.value;
  73. },
  74. onChnage() {
  75. this.$emit("sort", this.sort);
  76. }
  77. },
  78. };
  79. </script>
  80. <style lang="scss" scoped>
  81. label {
  82. cursor: pointer;
  83. transition: all 0.2s linear;
  84. }
  85. // input:checked+label {
  86. // color: #f48800 !important;
  87. // }
  88. select {
  89. background-image: url("~/assets/svg/down-arrow.svg");
  90. background-size: 9px 6px;
  91. background-position: right 20px center;
  92. background-repeat: no-repeat;
  93. }
  94. .rightBorder {
  95. position: relative;
  96. color: #757575;
  97. &::after {
  98. position: absolute;
  99. display: block;
  100. content: " ";
  101. width: 1px;
  102. height: 13px;
  103. right: 0;
  104. top: 50%;
  105. transform: translate(0, -50%);
  106. background-color: #e5e5e5;
  107. }
  108. }
  109. .btn-filter {
  110. background-image: url("~/assets/svg/filter.svg");
  111. background-position: center;
  112. background-repeat: no-repeat;
  113. background-size: 40px;
  114. }
  115. </style>