@ecomplus/widget-martan 1.1.22 → 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.
- package/.version +0 -0
- package/CHANGELOG.md +14 -0
- package/cms.config.js +78 -83
- package/dist/public/widget-martan.0.min.js +62 -0
- package/dist/public/widget-martan.0.min.js.map +1 -0
- package/dist/public/widget-martan.1.min.js.map +1 -1
- package/dist/public/widget-martan.2.min.js +1 -1
- package/dist/public/widget-martan.2.min.js.map +1 -1
- package/dist/public/widget-martan.3.min.js +1 -1
- package/dist/public/widget-martan.3.min.js.map +1 -1
- package/dist/public/widget-martan.4.min.js +1 -1
- package/dist/public/widget-martan.4.min.js.map +1 -1
- package/dist/public/widget-martan.5.min.js +1 -1
- package/dist/public/widget-martan.5.min.js.map +1 -1
- package/dist/public/widget-martan.6.min.js +2 -0
- package/dist/public/widget-martan.6.min.js.map +1 -0
- package/dist/public/widget-martan.7.min.js +2 -0
- package/dist/public/widget-martan.7.min.js.map +1 -0
- package/dist/public/widget-martan.8.min.js +2 -0
- package/dist/public/widget-martan.8.min.js.map +1 -0
- package/dist/public/widget-martan.9.min.js +2 -0
- package/dist/public/widget-martan.9.min.js.map +1 -0
- package/dist/public/widget-martan.var.min.js +3 -3
- package/dist/public/widget-martan.var.min.js.map +1 -1
- package/dist/widget-martan.0.min.js +62 -0
- package/dist/widget-martan.0.min.js.map +1 -0
- package/dist/widget-martan.1.min.js.map +1 -1
- package/dist/widget-martan.2.min.js +1 -1
- package/dist/widget-martan.2.min.js.map +1 -1
- package/dist/widget-martan.3.min.js +1 -1
- package/dist/widget-martan.3.min.js.map +1 -1
- package/dist/widget-martan.4.min.js +1 -1
- package/dist/widget-martan.4.min.js.map +1 -1
- package/dist/widget-martan.5.min.js +1 -1
- package/dist/widget-martan.5.min.js.map +1 -1
- package/dist/widget-martan.6.min.js +2 -0
- package/dist/widget-martan.6.min.js.map +1 -0
- package/dist/widget-martan.7.min.js +2 -0
- package/dist/widget-martan.7.min.js.map +1 -0
- package/dist/widget-martan.8.min.js +2 -0
- package/dist/widget-martan.8.min.js.map +1 -0
- package/dist/widget-martan.9.min.js +2 -0
- package/dist/widget-martan.9.min.js.map +1 -0
- package/dist/widget-martan.min.js +3 -3
- package/dist/widget-martan.min.js.map +1 -1
- package/package.json +2 -2
- package/src/append/product-block.ejs +5 -1
- package/src/append/product-card-slots.ejs +1 -1
- package/src/append/product-slots.ejs +1 -9
- package/src/index.js +17 -12
- package/src/utils/configProps.js +29 -0
- package/src/utils/lighten-color.js +20 -0
- package/src/utils/widget-initializer.js +60 -0
- package/src/widgets/questions/Questions.vue +436 -0
- package/src/widgets/questions/index.js +10 -0
- package/src/widgets/ratings/Rating.vue +223 -0
- package/src/widgets/ratings/index.js +232 -0
- package/src/widgets/reviews/Reviews.vue +317 -288
- package/src/widgets/reviews/components/Quickview.vue +390 -0
- package/src/widgets/reviews/components/Rating.vue +106 -0
- package/src/widgets/reviews/components/RatingBreakdown.vue +171 -0
- package/src/widgets/reviews/components/RatingHistogram.vue +306 -0
- package/src/widgets/reviews/components/RatingSummary.vue +226 -0
- package/src/widgets/reviews/components/RatingSummaryG.vue +104 -0
- package/src/widgets/reviews/components/ReviewCard.vue +223 -0
- package/src/widgets/reviews/{ReviewReply.vue → components/ReviewReply.vue} +42 -1
- package/src/widgets/reviews/{Score.vue → components/Score.vue} +3 -4
- package/src/widgets/reviews/{Sort.vue → components/Sort.vue} +1 -1
- package/src/widgets/reviews/components/SortDropdown.vue +184 -0
- package/src/widgets/reviews/components/VerifiedPurchase.vue +121 -0
- package/src/widgets/reviews/headers/Center.vue +248 -0
- package/src/widgets/reviews/headers/Compact.vue +225 -0
- package/src/widgets/reviews/headers/Histogram.vue +224 -0
- package/src/widgets/reviews/headers/Padrao.vue +113 -0
- package/src/widgets/reviews/headers/Summary.vue +217 -0
- package/src/widgets/reviews/index.js +2 -48
- package/src/append/body.ejs +0 -79
- package/src/append/head.ejs +0 -5
- package/src/append/stamps.ejs +0 -3
- package/src/widgets/reviews/AuthorAndRating.vue +0 -30
- package/src/widgets/reviews/AverageScore.vue +0 -160
- package/src/widgets/reviews/AverageTotal.vue +0 -35
- package/src/widgets/reviews/CardReview.vue +0 -87
- package/src/widgets/reviews/GridView.vue +0 -113
- package/src/widgets/reviews/HeaderExpanded.vue +0 -84
- package/src/widgets/reviews/HeaderMinimal.vue +0 -110
- package/src/widgets/reviews/ListView.vue +0 -47
- package/src/widgets/reviews/Quickview.vue +0 -397
- package/src/widgets/reviews/ReviewBody.vue +0 -39
- package/src/widgets/reviews/ThumbsPictures.vue +0 -135
- package/src/widgets/reviews/Total.vue +0 -79
- package/src/widgets/reviews/VerifiedPurchase.vue +0 -110
- package/src/widgets/reviews/isRecommended.vue +0 -44
- package/src/widgets/snippets/Rating.vue +0 -71
- package/src/widgets/snippets/Snippets.vue +0 -311
- package/src/widgets/snippets/index.js +0 -45
- /package/src/widgets/reviews/{VideoPlayer.vue → components/VideoPlayer.vue} +0 -0
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="mrtn-header--center">
|
|
3
|
+
<div class="mrtn-header__main">
|
|
4
|
+
<div class="mrtn-average-section">
|
|
5
|
+
<div class="mrtn-average-icon" :style="{ backgroundColor: lightenColor(config.widget_review.star_color, 0.8) }">
|
|
6
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" :stroke="config.widget_review.star_color"
|
|
7
|
+
:fill="average > 0 ? config.widget_review.star_color : 'none'" stroke-width="2" stroke-linecap="round"
|
|
8
|
+
stroke-linejoin="round">
|
|
9
|
+
<defs>
|
|
10
|
+
<linearGradient :id="'starGradient' + average">
|
|
11
|
+
<stop offset="0%" :stop-color="config.widget_review.star_color" />
|
|
12
|
+
<stop :offset="((average < 5 ? average - 1 : average) / 5) *
|
|
13
|
+
100 +
|
|
14
|
+
'%'
|
|
15
|
+
" :stop-color="config.widget_review.star_color" />
|
|
16
|
+
<stop :offset="((average < 5 ? average - 1 : average) / 5) *
|
|
17
|
+
100 +
|
|
18
|
+
'%'
|
|
19
|
+
" stop-color="transparent" />
|
|
20
|
+
<stop offset="100%" stop-color="transparent" />
|
|
21
|
+
</linearGradient>
|
|
22
|
+
</defs>
|
|
23
|
+
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
|
24
|
+
<path
|
|
25
|
+
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"
|
|
26
|
+
:fill="`url(#starGradient${average})`" />
|
|
27
|
+
</svg>
|
|
28
|
+
</div>
|
|
29
|
+
<div class="mrtn-average-info">
|
|
30
|
+
<span class="mrtn-average-score">{{ average.toFixed(1) }}</span>
|
|
31
|
+
<span class="mrtn-total-reviews">{{ formatReviewsCount }} Avaliações</span>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<RatingBreakdown :config="config" :rating="rating" :total-rating="totalRating" :current-active="currentActive"
|
|
37
|
+
@rating-selected="onRatingSelected" />
|
|
38
|
+
|
|
39
|
+
<div class="mrtn-filter-container">
|
|
40
|
+
<button class="mrtn-filter-btn" @click="toggleFilter">
|
|
41
|
+
Ordenar por
|
|
42
|
+
</button>
|
|
43
|
+
|
|
44
|
+
<SortDropdown :visible="showFilter" :current-sort="currentSort" @sort-selected="onSortSelected" @close="showFilter = false" />
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
</template>
|
|
48
|
+
|
|
49
|
+
<script>
|
|
50
|
+
import RatingBreakdown from '../components/RatingBreakdown.vue'
|
|
51
|
+
import SortDropdown from '../components/SortDropdown.vue'
|
|
52
|
+
import { configProp } from "../../../utils/configProps";
|
|
53
|
+
import { lightenColor } from "../../../utils/lighten-color";
|
|
54
|
+
|
|
55
|
+
export default {
|
|
56
|
+
name: 'Center',
|
|
57
|
+
|
|
58
|
+
components: {
|
|
59
|
+
RatingBreakdown,
|
|
60
|
+
SortDropdown
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
props: {
|
|
64
|
+
...configProp,
|
|
65
|
+
|
|
66
|
+
rating: {
|
|
67
|
+
type: Object,
|
|
68
|
+
default: () => ({
|
|
69
|
+
five: 0,
|
|
70
|
+
four: 0,
|
|
71
|
+
three: 0,
|
|
72
|
+
two: 0,
|
|
73
|
+
one: 0
|
|
74
|
+
})
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
recommended: {
|
|
78
|
+
type: Number,
|
|
79
|
+
default: 0
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
average: {
|
|
83
|
+
type: Number,
|
|
84
|
+
default: 0
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
totalRating: {
|
|
88
|
+
type: Number,
|
|
89
|
+
default: 0
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
data() {
|
|
94
|
+
return {
|
|
95
|
+
showDropdown: true,
|
|
96
|
+
showFilter: false,
|
|
97
|
+
currentSort: 'most_recent',
|
|
98
|
+
currentActive: null
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
computed: {
|
|
103
|
+
formatReviewsCount() {
|
|
104
|
+
if (this.totalRating >= 1000) {
|
|
105
|
+
return (this.totalRating / 1000).toFixed(1).replace('.0', '') + 'k'
|
|
106
|
+
}
|
|
107
|
+
return this.totalRating.toLocaleString()
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
methods: {
|
|
112
|
+
lightenColor,
|
|
113
|
+
toggleDropdown() {
|
|
114
|
+
this.showDropdown = !this.showDropdown
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
onRatingSelected(rating) {
|
|
118
|
+
if (this.currentActive === rating) {
|
|
119
|
+
this.currentActive = null
|
|
120
|
+
this.$emit('rating-selected', null)
|
|
121
|
+
} else {
|
|
122
|
+
this.currentActive = rating
|
|
123
|
+
this.$emit('rating-selected', rating)
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
|
|
127
|
+
onSortSelected(sortValue) {
|
|
128
|
+
this.currentSort = sortValue
|
|
129
|
+
this.showFilter = false
|
|
130
|
+
this.$emit('sort-selected', sortValue)
|
|
131
|
+
},
|
|
132
|
+
|
|
133
|
+
toggleFilter() {
|
|
134
|
+
this.showFilter = !this.showFilter
|
|
135
|
+
this.$emit('filter-toggle', this.showFilter)
|
|
136
|
+
},
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
</script>
|
|
140
|
+
|
|
141
|
+
<style lang="scss">
|
|
142
|
+
.mrtn-header--center .mrtn-rating-breakdown {
|
|
143
|
+
max-width: 520px;
|
|
144
|
+
width: 100%;
|
|
145
|
+
}
|
|
146
|
+
</style>
|
|
147
|
+
|
|
148
|
+
<style lang="scss" scoped>
|
|
149
|
+
.mrtn-filter-container {
|
|
150
|
+
position: relative;
|
|
151
|
+
|
|
152
|
+
.mrtn-filter-btn {
|
|
153
|
+
border: none;
|
|
154
|
+
background: transparent;
|
|
155
|
+
cursor: pointer;
|
|
156
|
+
color: #000000;
|
|
157
|
+
transition: all 0.2s ease;
|
|
158
|
+
|
|
159
|
+
&:hover {
|
|
160
|
+
color: #666666;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
&:active {
|
|
164
|
+
transform: scale(0.95);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.mrtn-header--center {
|
|
170
|
+
display: flex;
|
|
171
|
+
flex-direction: column;
|
|
172
|
+
align-items: center;
|
|
173
|
+
background: white;
|
|
174
|
+
position: relative;
|
|
175
|
+
gap: 12px;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.mrtn-header__main {
|
|
179
|
+
display: flex;
|
|
180
|
+
align-items: center;
|
|
181
|
+
gap: 16px;
|
|
182
|
+
max-width: 320px;
|
|
183
|
+
width: 100%;
|
|
184
|
+
justify-content: center;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.mrtn-average-section {
|
|
188
|
+
display: flex;
|
|
189
|
+
align-items: center;
|
|
190
|
+
gap: 12px;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.mrtn-average-icon {
|
|
194
|
+
display: flex;
|
|
195
|
+
align-items: center;
|
|
196
|
+
justify-content: center;
|
|
197
|
+
width: 40px;
|
|
198
|
+
height: 40px;
|
|
199
|
+
border-radius: 8px;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.mrtn-average-info {
|
|
203
|
+
display: flex;
|
|
204
|
+
flex-direction: column;
|
|
205
|
+
align-items: flex-start;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.mrtn-average-score {
|
|
209
|
+
font-size: 32px;
|
|
210
|
+
font-weight: 700;
|
|
211
|
+
color: #000000;
|
|
212
|
+
line-height: 1;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.mrtn-total-reviews {
|
|
216
|
+
font-size: 14px;
|
|
217
|
+
color: #666666;
|
|
218
|
+
margin-top: 4px;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.mrtn-dropdown-toggle {
|
|
222
|
+
display: flex;
|
|
223
|
+
align-items: center;
|
|
224
|
+
justify-content: center;
|
|
225
|
+
width: 32px;
|
|
226
|
+
height: 32px;
|
|
227
|
+
border: 1px solid #e5e5e5;
|
|
228
|
+
border-radius: 6px;
|
|
229
|
+
background: white;
|
|
230
|
+
cursor: pointer;
|
|
231
|
+
color: #000000;
|
|
232
|
+
transition: all 0.2s ease;
|
|
233
|
+
|
|
234
|
+
&:hover {
|
|
235
|
+
border-color: #cccccc;
|
|
236
|
+
background: #f8f8f8;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
&:active {
|
|
240
|
+
transform: scale(0.95);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
svg {
|
|
244
|
+
width: 12px;
|
|
245
|
+
height: 12px;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
</style>
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="mrtn-header--compact">
|
|
3
|
+
<div class="mrtn-header__rating">
|
|
4
|
+
<div class="mrtn-stars">
|
|
5
|
+
<Rating :rating="average" :color="config.widget_review.star_color" />
|
|
6
|
+
</div>
|
|
7
|
+
|
|
8
|
+
<div class="mrtn-header__info">
|
|
9
|
+
<span class="mrtn-reviews-count" @click="toggleDropdown">{{ formatReviewsCount }} Avaliações</span>
|
|
10
|
+
<button class="mrtn-dropdown-toggle" @click="toggleDropdown"
|
|
11
|
+
:class="{ 'mrtn-dropdown-toggle--active': showDropdown }">
|
|
12
|
+
<svg width="12" height="12" viewBox="0 0 12 12" fill="none">
|
|
13
|
+
<path d="M3 4.5L6 7.5L9 4.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"
|
|
14
|
+
stroke-linejoin="round" />
|
|
15
|
+
</svg>
|
|
16
|
+
</button>
|
|
17
|
+
|
|
18
|
+
<RatingSummary :config="config" :visible="showDropdown" :rating="rating" :average="average"
|
|
19
|
+
:total-ratings="totalRating" :recommended="recommended" @rating-selected="onRatingSelected"
|
|
20
|
+
@close="showDropdown = false" />
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<div class="mrtn-filter-container">
|
|
25
|
+
<button class="mrtn-filter-btn" @click="toggleFilter">
|
|
26
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none">
|
|
27
|
+
<path d="M2 4H14M4 8H12M6 12H10" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" />
|
|
28
|
+
<circle cx="4" cy="4" r="1.5" fill="currentColor" />
|
|
29
|
+
<circle cx="12" cy="8" r="1.5" fill="currentColor" />
|
|
30
|
+
<circle cx="8" cy="12" r="1.5" fill="currentColor" />
|
|
31
|
+
</svg>
|
|
32
|
+
</button>
|
|
33
|
+
|
|
34
|
+
<SortDropdown :visible="showFilter" :current-sort="currentSort" @sort-selected="onSortSelected" @close="showFilter = false" />
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</template>
|
|
38
|
+
|
|
39
|
+
<script>
|
|
40
|
+
import RatingSummary from '../components/RatingSummary.vue'
|
|
41
|
+
import SortDropdown from '../components/SortDropdown.vue'
|
|
42
|
+
import Rating from '../components/Rating.vue';
|
|
43
|
+
|
|
44
|
+
import { configProp } from "../../../utils/configProps";
|
|
45
|
+
|
|
46
|
+
export default {
|
|
47
|
+
name: 'Compact',
|
|
48
|
+
|
|
49
|
+
components: {
|
|
50
|
+
RatingSummary,
|
|
51
|
+
SortDropdown,
|
|
52
|
+
Rating
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
props: {
|
|
56
|
+
...configProp,
|
|
57
|
+
rating: {
|
|
58
|
+
type: Object,
|
|
59
|
+
default: () => ({
|
|
60
|
+
five: 0,
|
|
61
|
+
four: 0,
|
|
62
|
+
three: 0,
|
|
63
|
+
two: 0,
|
|
64
|
+
one: 0
|
|
65
|
+
})
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
recommended: {
|
|
69
|
+
type: Number,
|
|
70
|
+
default: 0
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
average: {
|
|
74
|
+
type: Number,
|
|
75
|
+
default: 0
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
totalRating: {
|
|
79
|
+
type: Number,
|
|
80
|
+
default: 0
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
data() {
|
|
85
|
+
return {
|
|
86
|
+
showDropdown: false,
|
|
87
|
+
showFilter: false,
|
|
88
|
+
currentSort: 'most_recent'
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
computed: {
|
|
93
|
+
formatReviewsCount() {
|
|
94
|
+
if (this.totalRating >= 1000) {
|
|
95
|
+
return (this.totalRating / 1000).toFixed(1).replace('.0', '') + 'k'
|
|
96
|
+
}
|
|
97
|
+
return this.totalRating.toLocaleString()
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
methods: {
|
|
102
|
+
toggleDropdown() {
|
|
103
|
+
this.showDropdown = !this.showDropdown
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
toggleFilter() {
|
|
107
|
+
this.showFilter = !this.showFilter
|
|
108
|
+
this.$emit('filter-toggle', this.showFilter)
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
onRatingSelected(rating) {
|
|
112
|
+
this.$emit('rating-selected', rating)
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
onSortSelected(sortValue) {
|
|
116
|
+
this.currentSort = sortValue
|
|
117
|
+
this.showFilter = false
|
|
118
|
+
this.$emit('sort-selected', sortValue)
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
</script>
|
|
123
|
+
|
|
124
|
+
<style lang="scss" scoped>
|
|
125
|
+
.mrtn-header--compact {
|
|
126
|
+
display: flex;
|
|
127
|
+
align-items: center;
|
|
128
|
+
justify-content: space-between;
|
|
129
|
+
padding: 16px 0;
|
|
130
|
+
background: white;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.mrtn-header__rating {
|
|
134
|
+
display: flex;
|
|
135
|
+
align-items: center;
|
|
136
|
+
gap: 12px;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.mrtn-stars {
|
|
140
|
+
display: flex;
|
|
141
|
+
gap: 2px;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.mrtn-star {
|
|
145
|
+
font-size: 16px;
|
|
146
|
+
color: #e5e5e5;
|
|
147
|
+
transition: color 0.2s ease;
|
|
148
|
+
|
|
149
|
+
&--filled {
|
|
150
|
+
color: #000000;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.mrtn-header__info {
|
|
155
|
+
display: flex;
|
|
156
|
+
align-items: center;
|
|
157
|
+
gap: 8px;
|
|
158
|
+
position: relative;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.mrtn-reviews-count {
|
|
162
|
+
font-size: 14px;
|
|
163
|
+
font-weight: 500;
|
|
164
|
+
color: #000000;
|
|
165
|
+
cursor: pointer;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.mrtn-dropdown-toggle {
|
|
169
|
+
display: flex;
|
|
170
|
+
align-items: center;
|
|
171
|
+
justify-content: center;
|
|
172
|
+
width: 20px;
|
|
173
|
+
height: 20px;
|
|
174
|
+
border: none;
|
|
175
|
+
background: transparent;
|
|
176
|
+
cursor: pointer;
|
|
177
|
+
color: #000000;
|
|
178
|
+
transition: transform 0.2s ease;
|
|
179
|
+
|
|
180
|
+
&:hover {
|
|
181
|
+
color: #666666;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
&--active {
|
|
185
|
+
transform: rotate(180deg);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
svg {
|
|
189
|
+
width: 12px;
|
|
190
|
+
height: 12px;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.mrtn-filter-container {
|
|
195
|
+
position: relative;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.mrtn-filter-btn {
|
|
199
|
+
display: flex;
|
|
200
|
+
align-items: center;
|
|
201
|
+
justify-content: center;
|
|
202
|
+
width: 25px;
|
|
203
|
+
height: 25px;
|
|
204
|
+
border: 1px solid #e5e5e5;
|
|
205
|
+
border-radius: 6px;
|
|
206
|
+
background: white;
|
|
207
|
+
cursor: pointer;
|
|
208
|
+
color: #000000;
|
|
209
|
+
transition: all 0.2s ease;
|
|
210
|
+
|
|
211
|
+
&:hover {
|
|
212
|
+
border-color: #cccccc;
|
|
213
|
+
background: #f8f8f8;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
&:active {
|
|
217
|
+
transform: scale(0.95);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
svg {
|
|
221
|
+
width: 16px;
|
|
222
|
+
height: 16px;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
</style>
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="mrtn-header--histogram">
|
|
3
|
+
|
|
4
|
+
<div class="mrtn-summary-container">
|
|
5
|
+
<div class="mrtn-summary-title">
|
|
6
|
+
<div class="mrtn-total-responses">{{ formatReviewsCount }} Avaliações</div>
|
|
7
|
+
<div v-if="recommended > 0" class="mrtn-recommendation">
|
|
8
|
+
{{ Math.round(recommended) }}% dos clientes recomendam esse produto
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
<div class="mrtn-average-section">
|
|
13
|
+
<div class="mrtn-average-display">
|
|
14
|
+
<div class="mrtn-stars-container">
|
|
15
|
+
<Rating :rating="average" :color="config.widget_review.star_color" />
|
|
16
|
+
</div>
|
|
17
|
+
<div class="mrtn-average-badge" :style="{ backgroundColor: config.widget_review.star_color }">
|
|
18
|
+
{{ average.toFixed(1) }} / 5
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<RatingHistogram :config="config" :rating="rating" :total-rating="totalRating" :average="average" @rating-selected="onRatingSelected" />
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script>
|
|
29
|
+
import Rating from '../components/Rating.vue'
|
|
30
|
+
import RatingHistogram from '../components/RatingHistogram.vue'
|
|
31
|
+
import { configProp } from "../../../utils/configProps";
|
|
32
|
+
|
|
33
|
+
export default {
|
|
34
|
+
name: 'Histogram',
|
|
35
|
+
|
|
36
|
+
components: {
|
|
37
|
+
Rating,
|
|
38
|
+
RatingHistogram
|
|
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
|
+
}
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
computed: {
|
|
77
|
+
ratingBreakdown() {
|
|
78
|
+
return {
|
|
79
|
+
5: this.rating.five,
|
|
80
|
+
4: this.rating.four,
|
|
81
|
+
3: this.rating.three,
|
|
82
|
+
2: this.rating.two,
|
|
83
|
+
1: this.rating.one
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
formatReviewsCount() {
|
|
88
|
+
if (this.totalRating >= 1000) {
|
|
89
|
+
return (this.totalRating / 1000).toFixed(1).replace('.0', '') + 'k'
|
|
90
|
+
}
|
|
91
|
+
return this.totalRating.toLocaleString()
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
methods: {
|
|
96
|
+
getBarWidth(count) {
|
|
97
|
+
if (this.totalRating === 0) return 0
|
|
98
|
+
return (count / this.totalRating) * 100
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
onRatingSelected(rating) {
|
|
102
|
+
this.currentActive = rating
|
|
103
|
+
this.$emit('rating-selected', rating)
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
</script>
|
|
108
|
+
|
|
109
|
+
<style lang="scss" scoped>
|
|
110
|
+
.mrtn-header--histogram {
|
|
111
|
+
background-color: #f3f3f3;
|
|
112
|
+
border-radius: 8px;
|
|
113
|
+
padding: 8px 16px;
|
|
114
|
+
width: 100%;
|
|
115
|
+
margin-bottom: 1rem;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.mrtn-summary-container {
|
|
119
|
+
display: flex;
|
|
120
|
+
align-items: center;
|
|
121
|
+
justify-content: space-between;
|
|
122
|
+
margin-top: 1rem;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.mrtn-summary-title {
|
|
126
|
+
margin-bottom: 20px;
|
|
127
|
+
|
|
128
|
+
.mrtn-title {
|
|
129
|
+
font-size: 24px;
|
|
130
|
+
font-weight: 700;
|
|
131
|
+
color: #000000;
|
|
132
|
+
margin: 0 0 8px 0;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.mrtn-total-responses {
|
|
136
|
+
font-size: 20px;
|
|
137
|
+
color: #333333;
|
|
138
|
+
font-weight: 300;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.mrtn-recommendation {
|
|
143
|
+
font-size: 16px;
|
|
144
|
+
color: #666666;
|
|
145
|
+
font-weight: 100;
|
|
146
|
+
|
|
147
|
+
@media (max-width: 580px) {
|
|
148
|
+
font-size: 12px;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.mrtn-average-section {
|
|
153
|
+
display: flex;
|
|
154
|
+
justify-content: center;
|
|
155
|
+
margin-bottom: 16px;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.mrtn-average-display {
|
|
159
|
+
display: flex;
|
|
160
|
+
align-items: center;
|
|
161
|
+
gap: 12px;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.mrtn-stars-container {
|
|
165
|
+
display: flex;
|
|
166
|
+
align-items: center;
|
|
167
|
+
|
|
168
|
+
@media (max-width: 580px) {
|
|
169
|
+
display: none;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.mrtn-average-badge {
|
|
174
|
+
background: #ff6b35;
|
|
175
|
+
color: white;
|
|
176
|
+
padding: 8px 16px;
|
|
177
|
+
border-radius: 20px;
|
|
178
|
+
font-weight: 600;
|
|
179
|
+
font-size: 14px;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.mrtn-rating-breakdown {
|
|
183
|
+
display: flex;
|
|
184
|
+
flex-direction: column;
|
|
185
|
+
gap: 8px;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.mrtn-rating-row {
|
|
189
|
+
display: flex;
|
|
190
|
+
align-items: center;
|
|
191
|
+
gap: 12px;
|
|
192
|
+
padding: 4px 0;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.mrtn-rating-label {
|
|
196
|
+
font-size: 12px;
|
|
197
|
+
color: #666666;
|
|
198
|
+
min-width: 70px;
|
|
199
|
+
text-align: left;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.mrtn-rating-bar {
|
|
203
|
+
flex: 1;
|
|
204
|
+
height: 12px;
|
|
205
|
+
background: #f0f0f0;
|
|
206
|
+
border-radius: 6px;
|
|
207
|
+
overflow: hidden;
|
|
208
|
+
position: relative;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.mrtn-rating-bar__fill {
|
|
212
|
+
height: 100%;
|
|
213
|
+
border-radius: 6px;
|
|
214
|
+
transition: width 0.3s ease;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.mrtn-rating-count {
|
|
218
|
+
font-size: 12px;
|
|
219
|
+
color: #666666;
|
|
220
|
+
min-width: 40px;
|
|
221
|
+
text-align: right;
|
|
222
|
+
font-weight: 500;
|
|
223
|
+
}
|
|
224
|
+
</style>
|