Skip to content

Commit

Permalink
feat(price card): show product price_count (#127)
Browse files Browse the repository at this point in the history
Show product price_count in PriceCard
  • Loading branch information
raphodn authored Jan 12, 2024
1 parent eb5d6e3 commit c9e35df
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/components/PriceCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
<h3 v-if="!hideProductTitle" @click="goToProduct()">{{ getPriceProductTitle() }}</h3>

<p v-if="!hideProductDetails" class="mb-2">
<span v-if="!price">
<v-chip label size="small" density="comfortable" :color="getProductPriceCountColor" class="mr-1" @click="goToProduct()">
<v-icon start icon="mdi-tag-outline"></v-icon>
{{ product.price_count }}
</v-chip>
</span>
<span v-if="hasProductBrands">
<v-chip v-for="brand in getProductBrandsList" label size="small" density="comfortable" class="mr-1" @click="goToBrand(brand)">
{{ brand }}
Expand Down Expand Up @@ -132,6 +138,17 @@ export default {
return tag ? tag.name : this.price.category_tag
}
},
getProductPriceCountColor() {
if (this.product.price_count === 0) {
return 'error'
}
if (this.product.price_count === 1) {
return 'warning'
}
if (this.product.price_count > 1) {
return 'success'
}
},
getProductBrandsList() {
if (this.hasProductBrands) {
return this.product.brands.split(',')
Expand Down

0 comments on commit c9e35df

Please sign in to comment.