@ecomplus/widget-martan 1.1.24 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/cms.config.js +78 -83
  3. package/dist/public/widget-martan.0.min.js +62 -0
  4. package/dist/public/widget-martan.0.min.js.map +1 -0
  5. package/dist/public/widget-martan.2.min.js +1 -1
  6. package/dist/public/widget-martan.2.min.js.map +1 -1
  7. package/dist/public/widget-martan.3.min.js +1 -1
  8. package/dist/public/widget-martan.3.min.js.map +1 -1
  9. package/dist/public/widget-martan.4.min.js +1 -1
  10. package/dist/public/widget-martan.4.min.js.map +1 -1
  11. package/dist/public/widget-martan.5.min.js +1 -1
  12. package/dist/public/widget-martan.5.min.js.map +1 -1
  13. package/dist/public/widget-martan.6.min.js +2 -0
  14. package/dist/public/widget-martan.6.min.js.map +1 -0
  15. package/dist/public/widget-martan.7.min.js +2 -0
  16. package/dist/public/widget-martan.7.min.js.map +1 -0
  17. package/dist/public/widget-martan.8.min.js +2 -0
  18. package/dist/public/widget-martan.8.min.js.map +1 -0
  19. package/dist/public/widget-martan.9.min.js +2 -0
  20. package/dist/public/widget-martan.9.min.js.map +1 -0
  21. package/dist/public/widget-martan.var.min.js +3 -3
  22. package/dist/public/widget-martan.var.min.js.map +1 -1
  23. package/dist/widget-martan.0.min.js +62 -0
  24. package/dist/widget-martan.0.min.js.map +1 -0
  25. package/dist/widget-martan.2.min.js +1 -1
  26. package/dist/widget-martan.2.min.js.map +1 -1
  27. package/dist/widget-martan.3.min.js +1 -1
  28. package/dist/widget-martan.3.min.js.map +1 -1
  29. package/dist/widget-martan.4.min.js +1 -1
  30. package/dist/widget-martan.4.min.js.map +1 -1
  31. package/dist/widget-martan.5.min.js +1 -1
  32. package/dist/widget-martan.5.min.js.map +1 -1
  33. package/dist/widget-martan.6.min.js +2 -0
  34. package/dist/widget-martan.6.min.js.map +1 -0
  35. package/dist/widget-martan.7.min.js +2 -0
  36. package/dist/widget-martan.7.min.js.map +1 -0
  37. package/dist/widget-martan.8.min.js +2 -0
  38. package/dist/widget-martan.8.min.js.map +1 -0
  39. package/dist/widget-martan.9.min.js +2 -0
  40. package/dist/widget-martan.9.min.js.map +1 -0
  41. package/dist/widget-martan.min.js +3 -3
  42. package/dist/widget-martan.min.js.map +1 -1
  43. package/package.json +2 -2
  44. package/src/append/product-block.ejs +5 -1
  45. package/src/append/product-card-slots.ejs +1 -1
  46. package/src/append/product-slots.ejs +1 -9
  47. package/src/index.js +17 -12
  48. package/src/utils/configProps.js +29 -0
  49. package/src/utils/lighten-color.js +20 -0
  50. package/src/utils/widget-initializer.js +60 -0
  51. package/src/widgets/questions/Questions.vue +436 -0
  52. package/src/widgets/questions/index.js +10 -0
  53. package/src/widgets/ratings/Rating.vue +223 -0
  54. package/src/widgets/ratings/index.js +232 -0
  55. package/src/widgets/reviews/Reviews.vue +317 -288
  56. package/src/widgets/reviews/components/Quickview.vue +390 -0
  57. package/src/widgets/reviews/components/Rating.vue +106 -0
  58. package/src/widgets/reviews/components/RatingBreakdown.vue +171 -0
  59. package/src/widgets/reviews/components/RatingHistogram.vue +306 -0
  60. package/src/widgets/reviews/components/RatingSummary.vue +226 -0
  61. package/src/widgets/reviews/components/RatingSummaryG.vue +104 -0
  62. package/src/widgets/reviews/components/ReviewCard.vue +223 -0
  63. package/src/widgets/reviews/{ReviewReply.vue → components/ReviewReply.vue} +42 -1
  64. package/src/widgets/reviews/{Score.vue → components/Score.vue} +3 -4
  65. package/src/widgets/reviews/{Sort.vue → components/Sort.vue} +1 -1
  66. package/src/widgets/reviews/components/SortDropdown.vue +184 -0
  67. package/src/widgets/reviews/components/VerifiedPurchase.vue +121 -0
  68. package/src/widgets/reviews/headers/Center.vue +248 -0
  69. package/src/widgets/reviews/headers/Compact.vue +225 -0
  70. package/src/widgets/reviews/headers/Histogram.vue +224 -0
  71. package/src/widgets/reviews/headers/Padrao.vue +113 -0
  72. package/src/widgets/reviews/headers/Summary.vue +217 -0
  73. package/src/widgets/reviews/index.js +2 -48
  74. package/src/append/body.ejs +0 -79
  75. package/src/append/head.ejs +0 -5
  76. package/src/append/stamps.ejs +0 -3
  77. package/src/widgets/reviews/AuthorAndRating.vue +0 -30
  78. package/src/widgets/reviews/AverageScore.vue +0 -160
  79. package/src/widgets/reviews/AverageTotal.vue +0 -35
  80. package/src/widgets/reviews/CardReview.vue +0 -87
  81. package/src/widgets/reviews/GridView.vue +0 -113
  82. package/src/widgets/reviews/HeaderExpanded.vue +0 -84
  83. package/src/widgets/reviews/HeaderMinimal.vue +0 -110
  84. package/src/widgets/reviews/ListView.vue +0 -47
  85. package/src/widgets/reviews/Quickview.vue +0 -397
  86. package/src/widgets/reviews/ReviewBody.vue +0 -39
  87. package/src/widgets/reviews/ThumbsPictures.vue +0 -135
  88. package/src/widgets/reviews/Total.vue +0 -79
  89. package/src/widgets/reviews/VerifiedPurchase.vue +0 -110
  90. package/src/widgets/reviews/isRecommended.vue +0 -44
  91. package/src/widgets/snippets/Rating.vue +0 -71
  92. package/src/widgets/snippets/Snippets.vue +0 -311
  93. package/src/widgets/snippets/index.js +0 -45
  94. /package/src/widgets/reviews/{VideoPlayer.vue → components/VideoPlayer.vue} +0 -0
@@ -0,0 +1,113 @@
1
+ <template>
2
+ <div class="widget-sort" v-if="totalRating > 0">
3
+ <span class="average_geral">
4
+ <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" :stroke="config.widget_review.star_color"
5
+ :fill="average > 0 ? config.widget_review.star_color : 'none'" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
6
+ <defs>
7
+ <linearGradient :id="'starGradient' + average">
8
+ <stop offset="0%" :stop-color="config.widget_review.star_color" />
9
+ <stop :offset="((average < 5 ? average - 1 : average) / 5) *
10
+ 100 +
11
+ '%'
12
+ " :stop-color="config.widget_review.star_color" />
13
+ <stop :offset="((average < 5 ? average - 1 : average) / 5) *
14
+ 100 +
15
+ '%'
16
+ " stop-color="transparent" />
17
+ <stop offset="100%" stop-color="transparent" />
18
+ </linearGradient>
19
+ </defs>
20
+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />
21
+ <path
22
+ d="M8.243 7.34l-6.38 .925l-.113 .023a1 1 0 0 0 -.44 1.684l4.622 4.499l-1.09 6.355l-.013 .11a1 1 0 0 0 1.464 .944l5.706 -3l5.693 3l.1 .046a1 1 0 0 0 1.352 -1.1l-1.091 -6.355l4.624 -4.5l.078 -.085a1 1 0 0 0 -.633 -1.62l-6.38 -.926l-2.852 -5.78a1 1 0 0 0 -1.794 0l-2.853 5.78z"
23
+ :fill="`url(#starGradient${average})`" />
24
+ </svg>
25
+
26
+ <strong>{{ average.toFixed(1) }}</strong> / 5
27
+
28
+ <span class="baseado" style="font-size: 10px; opacity: 0.8">
29
+ ({{
30
+ totalRating > 1
31
+ ? i19basedOn$1Reviews.replace("$1", totalRating)
32
+ : i19basedOn$1Review.replace("$1", totalRating)
33
+ }})
34
+ </span>
35
+ </span>
36
+
37
+ <sort @onSort="onSort" />
38
+ </div>
39
+ </template>
40
+
41
+ <script>
42
+ import { configProp } from "../../../utils/configProps";
43
+ import Sort from "../components/Sort.vue";
44
+
45
+ export default {
46
+ name: "Padrao",
47
+
48
+ props: {
49
+ ...configProp,
50
+ config: {
51
+ type: Object,
52
+ required: true,
53
+ },
54
+ totalRating: {
55
+ type: Number,
56
+ required: true,
57
+ },
58
+ average: {
59
+ type: Number,
60
+ required: true,
61
+ },
62
+ },
63
+
64
+ computed: {
65
+ i19basedOn$1Reviews: () => "Baseado em $1 avaliações",
66
+ i19basedOn$1Review: () => "Baseado em $1 avaliação",
67
+ },
68
+
69
+ methods: {
70
+ onSort({ order }) {
71
+ this.$emit('onSort', { order });
72
+ },
73
+ },
74
+
75
+ components: {
76
+ Sort,
77
+ },
78
+ };
79
+ </script>
80
+
81
+ <style lang="scss" scoped>
82
+ .widget-sort {
83
+ background-color: #ffecdb1a;
84
+ border: 1px solid #ffecdb1a;
85
+ border-radius: 0.25rem;
86
+ margin-top: 1rem;
87
+ margin-bottom: 1rem;
88
+ // padding: 1rem 2rem;
89
+ max-height: 30px;
90
+ width: 100%;
91
+ font-size: 1.25rem;
92
+ display: flex;
93
+ justify-content: space-between;
94
+ align-items: center;
95
+
96
+ .average_geral {
97
+ svg {
98
+ vertical-align: baseline;
99
+ }
100
+
101
+ .baseado {
102
+ @media (max-width: 580px) {
103
+ display: none;
104
+ }
105
+ }
106
+ }
107
+
108
+ @media (max-width: 580px) {
109
+ padding: 0;
110
+ }
111
+
112
+ }
113
+ </style>
@@ -0,0 +1,217 @@
1
+ <template>
2
+ <div class="mrtn-header--summary">
3
+ <RatingBreakdown :config="config" :rating="rating" :total-rating="totalRating" :current-active="currentActive"
4
+ @rating-selected="onRatingSelected" />
5
+
6
+ <div class="mrtn-summary-container">
7
+ <div class="mrtn-summary-title">
8
+ <div class="mrtn-total-responses">{{ formatReviewsCount }} {{ this.totalRating > 1 ? 'Avaliações' : 'Avaliação' }}</div>
9
+ <div v-if="recommended > 0" class="mrtn-recommendation">
10
+ {{ Math.round(recommended) }}% dos clientes recomendam esse produto
11
+ </div>
12
+ </div>
13
+
14
+ <div class="mrtn-average-section">
15
+ <div class="mrtn-average-display">
16
+ <div class="mrtn-stars-container">
17
+ <Rating :rating="average" :color="config.widget_review.star_color" />
18
+ </div>
19
+ <div class="mrtn-average-badge" :style="{ backgroundColor: config.widget_review.star_color }">
20
+ {{ average.toFixed(1) }} / 5
21
+ </div>
22
+ </div>
23
+ </div>
24
+ </div>
25
+ </div>
26
+ </template>
27
+
28
+ <script>
29
+ import Rating from '../components/Rating.vue'
30
+ import RatingBreakdown from '../components/RatingBreakdown.vue'
31
+ import { configProp } from "../../../utils/configProps";
32
+
33
+ export default {
34
+ name: 'Summary',
35
+
36
+ components: {
37
+ Rating,
38
+ RatingBreakdown
39
+ },
40
+
41
+ props: {
42
+ ...configProp,
43
+
44
+ rating: {
45
+ type: Object,
46
+ default: () => ({
47
+ five: 0,
48
+ four: 0,
49
+ three: 0,
50
+ two: 0,
51
+ one: 0
52
+ })
53
+ },
54
+
55
+ recommended: {
56
+ type: Number,
57
+ default: 0
58
+ },
59
+
60
+ average: {
61
+ type: Number,
62
+ default: 0
63
+ },
64
+
65
+ totalRating: {
66
+ type: Number,
67
+ default: 0
68
+ }
69
+ },
70
+
71
+ data() {
72
+ return {
73
+ currentActive: null
74
+ }
75
+ },
76
+
77
+ computed: {
78
+ ratingBreakdown() {
79
+ return {
80
+ 5: this.rating.five,
81
+ 4: this.rating.four,
82
+ 3: this.rating.three,
83
+ 2: this.rating.two,
84
+ 1: this.rating.one
85
+ }
86
+ },
87
+
88
+ formatReviewsCount() {
89
+ if (this.totalRating >= 1000) {
90
+ return (this.totalRating / 1000).toFixed(1).replace('.0', '') + 'k'
91
+ }
92
+ return this.totalRating.toLocaleString()
93
+ }
94
+ },
95
+
96
+ methods: {
97
+ getBarWidth(count) {
98
+ if (this.totalRating === 0) return 0
99
+ return (count / this.totalRating) * 100
100
+ },
101
+
102
+ onRatingSelected(rating) {
103
+ this.currentActive = rating
104
+ this.$emit('rating-selected', rating)
105
+ }
106
+ }
107
+ }
108
+ </script>
109
+
110
+ <style lang="scss" scoped>
111
+ .mrtn-summary-container {
112
+ display: flex;
113
+ align-items: center;
114
+ justify-content: space-between;
115
+ margin-top: 1rem;
116
+ }
117
+
118
+ .mrtn-summary-title {
119
+ margin-bottom: 20px;
120
+
121
+ .mrtn-title {
122
+ font-size: 24px;
123
+ font-weight: 700;
124
+ color: #000000;
125
+ margin: 0 0 8px 0;
126
+ }
127
+
128
+ .mrtn-total-responses {
129
+ font-size: 20px;
130
+ color: #333333;
131
+ font-weight: 300;
132
+ }
133
+ }
134
+
135
+ .mrtn-recommendation {
136
+ font-size: 16px;
137
+ color: #666666;
138
+ font-weight: 100;
139
+
140
+ @media (max-width: 580px) {
141
+ font-size: 12px;
142
+ }
143
+ }
144
+
145
+ .mrtn-average-section {
146
+ display: flex;
147
+ justify-content: center;
148
+ margin-bottom: 16px;
149
+ }
150
+
151
+ .mrtn-average-display {
152
+ display: flex;
153
+ align-items: center;
154
+ gap: 12px;
155
+ }
156
+
157
+ .mrtn-stars-container {
158
+ display: flex;
159
+ align-items: center;
160
+
161
+ @media (max-width: 580px) {
162
+ display: none;
163
+ }
164
+ }
165
+
166
+ .mrtn-average-badge {
167
+ background: #ff6b35;
168
+ color: white;
169
+ padding: 8px 16px;
170
+ border-radius: 20px;
171
+ font-weight: 600;
172
+ font-size: 14px;
173
+ }
174
+
175
+ .mrtn-rating-breakdown {
176
+ display: flex;
177
+ flex-direction: column;
178
+ gap: 8px;
179
+ }
180
+
181
+ .mrtn-rating-row {
182
+ display: flex;
183
+ align-items: center;
184
+ gap: 12px;
185
+ padding: 4px 0;
186
+ }
187
+
188
+ .mrtn-rating-label {
189
+ font-size: 12px;
190
+ color: #666666;
191
+ min-width: 70px;
192
+ text-align: left;
193
+ }
194
+
195
+ .mrtn-rating-bar {
196
+ flex: 1;
197
+ height: 12px;
198
+ background: #f0f0f0;
199
+ border-radius: 6px;
200
+ overflow: hidden;
201
+ position: relative;
202
+ }
203
+
204
+ .mrtn-rating-bar__fill {
205
+ height: 100%;
206
+ border-radius: 6px;
207
+ transition: width 0.3s ease;
208
+ }
209
+
210
+ .mrtn-rating-count {
211
+ font-size: 12px;
212
+ color: #666666;
213
+ min-width: 40px;
214
+ text-align: right;
215
+ font-weight: 500;
216
+ }
217
+ </style>
@@ -1,52 +1,6 @@
1
- import Vue from 'vue'
1
+ import widgetInitializer from '../../utils/widget-initializer'
2
2
  import Reviews from './Reviews.vue'
3
3
 
4
4
  export default (options = {}, elId = 'reviews_widget') => {
5
- const $el = document.getElementById(elId)
6
- if (!options || !$el || !$el.dataset || !$el.dataset.product) {
7
- return
8
- }
9
-
10
- const { product } = $el.dataset
11
-
12
- const storeId = options.store_id
13
- const webId = options.web_id
14
- const widgetOptions = options.widget_review || {}
15
-
16
- const starColor = widgetOptions.star_color || null
17
- const title = widgetOptions.title || null
18
- const headerLayout = widgetOptions.header_layout || null
19
- const reviewsLayout = widgetOptions.reviews_layout || null
20
-
21
- const obs = new IntersectionObserver(
22
- (entries, observe) => {
23
- entries.forEach(function (entry) {
24
- const { isIntersecting, intersectionRatio } = entry
25
- if (isIntersecting === true || intersectionRatio > 0) {
26
- new Vue({
27
- render(h) {
28
- return h(Reviews, {
29
- props: {
30
- product,
31
- storeId,
32
- webId,
33
- title,
34
- starColor,
35
- headerLayout,
36
- reviewsLayout
37
- }
38
- })
39
- }
40
- }).$mount($el)
41
-
42
- observe.disconnect()
43
- }
44
- })
45
- },
46
- {
47
- rootMargin: '250px'
48
- }
49
- )
50
-
51
- obs.observe($el)
5
+ return widgetInitializer(options, elId, Reviews)
52
6
  }
@@ -1,79 +0,0 @@
1
- <script>
2
- document.addEventListener("DOMContentLoaded", function (event) {
3
- const scriptUrl =
4
- "<%- options.widgets_src || 'https://unpkg.com/@martan-app/widgets-js@1.1.23/dist/martan.umd.js' %>"
5
-
6
- const startWidget = () => {
7
- const color =
8
- "<%- options.widget_rating && options.widget_rating.star_color || '#000' %>"
9
- const fontSize =
10
- "<%- options.widget_rating && options.widget_rating.font_size || 14 %>"
11
-
12
- const storeId = "<%- options.store_id %>"
13
- const widgetKey = "<%- options.widget_key %>"
14
- const webId = "<%- options.web_id %>"
15
-
16
- setTimeout(() => {
17
- try {
18
- const martan = new window.Martan({
19
- storeId: parseInt(storeId, 10),
20
- widgetKey,
21
- webId
22
- })
23
-
24
- const init = () =>
25
- martan
26
- .average({
27
- fontSize,
28
- color,
29
- classes: ['.product-card__rating']
30
- })
31
- .start()
32
-
33
- const $searchEngine = document.getElementById("search-engine")
34
- if (!$searchEngine) {
35
- init()
36
- } else {
37
- const displayOnSearchPage =
38
- "<%- options.widget_rating && options.widget_rating.search_page %>"
39
-
40
- if (displayOnSearchPage === "true") {
41
- const callback = () => {
42
- searchEngineObserver.disconnect()
43
- const $retailRow = $searchEngine.querySelectorAll(
44
- ".search-engine__retail > .row"
45
- )[0]
46
-
47
- const rowObserver = new MutationObserver(() => {
48
- setTimeout(() => init(), 100)
49
- rowObserver.disconnect()
50
- })
51
- rowObserver.observe($retailRow, {
52
- childList: true,
53
- subtree: true,
54
- })
55
- }
56
- const searchEngineObserver = new MutationObserver(callback)
57
- searchEngineObserver.observe($searchEngine, {
58
- attributes: true,
59
- childList: true,
60
- })
61
- }
62
- }
63
- } catch (error) {}
64
- }, 50)
65
- }
66
-
67
- const isEnabled =
68
- "<%- options.widget_rating && options.widget_rating.is_enabled %>"
69
-
70
- if (isEnabled === "true") {
71
- const script = document.createElement("script")
72
- script.setAttribute("src", scriptUrl)
73
- script.setAttribute("id", "martan-scripts")
74
- script.async = true
75
- document.body.appendChild(script)
76
- script.onload = startWidget
77
- }
78
- })
79
- </script>
@@ -1,5 +0,0 @@
1
- <style>
2
- #reviews_widget {
3
- min-height: 230px;
4
- }
5
- </style>
@@ -1,3 +0,0 @@
1
- <% if (!options.disable_certificate) { %>
2
- <div />
3
- <% } %>
@@ -1,30 +0,0 @@
1
- <template>
2
- <div style="display: flex;align-items: baseline; justify-content: space-between">
3
- <div style="display: flex; height: 20px; align-items: center; gap: 5px">
4
- <div class="mt-review__author" style="padding-right: 2px">
5
- <span>{{ isAnonymous ? "Anônimo" : author }}</span>
6
- </div>
7
-
8
- <rating :rating="rating" :color="starColor" />
9
- </div>
10
- </div>
11
- </template>
12
-
13
- <script>
14
- import Rating from "../snippets/Rating.vue";
15
-
16
- export default {
17
- name: "AuthorAndRating",
18
-
19
- props: {
20
- isAnonymous: Boolean,
21
- author: String,
22
- rating: Number,
23
- starColor: String,
24
- },
25
-
26
- components: {
27
- Rating,
28
- },
29
- };
30
- </script>
@@ -1,160 +0,0 @@
1
- <template>
2
- <ul class="mt-rating__options" ref="options">
3
- <li class="mt-rating__list" v-for="index in maxReviews" :key="index"
4
- v-on:click="(e) => (reviews.total === 0 ? null : setRating(e, index))">
5
- <div class="mt-rating-star">
6
- <span>{{ index }}</span>
7
-
8
- <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-star" width="14" height="14"
9
- viewBox="0 0 24 24" stroke-width="2" stroke="#e3e6e6" fill="none" stroke-linecap="round"
10
- stroke-linejoin="round">
11
- <path stroke="none" d="M0 0h24v24H0z" fill="none" />
12
- <path
13
- d="M12 17.75l-6.172 3.245l1.179 -6.873l-5 -4.867l6.9 -1l3.086 -6.253l3.086 6.253l6.9 1l-5 4.867l1.179 6.873z" />
14
- </svg>
15
- </div>
16
-
17
- <div class="mt-rating-meter">
18
- <div class="mt-rating-bar" v-bind:style="{
19
- width: reviews.getWidth(index),
20
- 'background-color': config.star_color || 'red',
21
- }" />
22
- </div>
23
-
24
- <div class="mt-rating-total">
25
- <span>{{ reviews.average[numberToText(index)] }}</span>
26
- <span>({{ reviews.getWidth(index) }})</span>
27
-
28
- <span class="mt-rating-remove"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-x"
29
- width="15" height="15" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none"
30
- stroke-linecap="round" stroke-linejoin="round">
31
- <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
32
- <path d="M18 6l-12 12"></path>
33
- <path d="M6 6l12 12"></path>
34
- </svg></span>
35
- </div>
36
- </li>
37
- </ul>
38
- </template>
39
-
40
-
41
- <script>
42
- export default {
43
- name: 'AverageScore',
44
-
45
- props: {
46
- },
47
-
48
- data() {
49
- return {
50
- maxReviews: 5
51
- };
52
- },
53
-
54
- methods: {
55
- async setRating(e, rating) {
56
- const removeClass = () =>
57
- new Promise((resolve) => {
58
- const res = Array.from(options.value.children).map((option) => {
59
- option.style.removeProperty("opacity")
60
- option.children[0].childNodes[1].style.stroke = "rgb(227, 230, 230)"
61
- return option.classList.remove("is-active")
62
- })
63
-
64
- resolve(res)
65
- })
66
-
67
- await removeClass().then(() => {
68
- if (rating !== reviews.orderRating) {
69
- const el = Array.from(options.value.children)[rating - 1]
70
- el.classList.add("is-active")
71
- el.style.opacity = 1
72
- el.children[0].childNodes[1].style.stroke = config.star_color
73
- Array.from(options.value.children).forEach((option, index) => {
74
- if (index !== rating - 1) {
75
- option.style.opacity = ".5"
76
- }
77
- })
78
- }
79
- })
80
-
81
- if (rating === reviews.orderRating) {
82
- reviews.orderRating = null
83
- } else {
84
- reviews.offset = 0
85
- reviews.orderRating = rating
86
- }
87
- }
88
- },
89
- };
90
- </script>
91
-
92
- <style>
93
- .mt-rating-remove {
94
- visibility: hidden;
95
- cursor: pointer;
96
- display: flex;
97
- align-items: center;
98
- }
99
-
100
- .mt-rating__list.is-active .mt-rating-remove {
101
- visibility: visible;
102
- }
103
-
104
- .mt-rating__options li:hover {
105
- cursor: pointer;
106
- }
107
-
108
- .mt-rating__list {
109
- display: flex;
110
- align-items: center;
111
- height: 23px;
112
- }
113
-
114
- .mt-rating__list.is-active .mt-rating-total,
115
- .mt-rating__list:hover .mt-rating-total {
116
- visibility: visible;
117
- }
118
-
119
- .mt-rating__list:hover {
120
- opacity: 0.9;
121
- }
122
-
123
- .mt-rating-meter {
124
- overflow: hidden;
125
- box-shadow: inset 0 0 0 1px #e3e6e6;
126
- background-color: #e3e6e6;
127
- height: 10px;
128
- width: 100%;
129
- border-radius: 50px;
130
- display: flex;
131
- }
132
-
133
- .mt-rating__options {
134
- margin: 0;
135
- list-style: none;
136
- padding: 0;
137
- max-width: 800px;
138
- width: 100%;
139
- }
140
-
141
- .mt-rating-star {
142
- display: flex;
143
- width: 30px;
144
- justify-content: space-around;
145
- font-size: 12px;
146
- color: #757373;
147
- align-items: center;
148
- margin-left: 5px;
149
- }
150
-
151
- .mt-rating-total {
152
- visibility: hidden;
153
- width: 50px;
154
- font-size: 12px;
155
- color: #757373;
156
- margin-left: 2px;
157
- display: flex;
158
- gap: 3px;
159
- }
160
- </style>
@@ -1,35 +0,0 @@
1
- <script>
2
- export default {
3
- name: 'AverageTotal',
4
-
5
- props: {
6
- average: {
7
- type: Number,
8
- default: 0
9
- }
10
- },
11
- };
12
- </script>
13
-
14
- <template>
15
- <div class="mt-rating__resume" :title="'Nota média ' + average">
16
- <div class="mt-rating__average">
17
- <div class="mt-rating__average__wrapper">
18
- <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-star-filled" width="24" height="24"
19
- viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round"
20
- stroke-linejoin="round">
21
- <path stroke="none" d="M0 0h24v24H0z" fill="none" />
22
- <path
23
- d="M8.243 7.34l-6.38 .925l-.113 .023a1 1 0 0 0 -.44 1.684l4.622 4.499l-1.09 6.355l-.013 .11a1 1 0 0 0 1.464 .944l5.706 -3l5.693 3l.1 .046a1 1 0 0 0 1.352 -1.1l-1.091 -6.355l4.624 -4.5l.078 -.085a1 1 0 0 0 -.633 -1.62l-6.38 -.926l-2.852 -5.78a1 1 0 0 0 -1.794 0l-2.853 5.78z"
24
- stroke-width="0" fill="currentColor" />
25
- </svg>
26
- </div>
27
-
28
- <div style="margin-left: 10px">
29
- <p class="mt-rating__average--total">
30
- {{ average }}
31
- </p>
32
- </div>
33
- </div>
34
- </div>
35
- </template>