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.
willaengine/resources/js/Global/components/Blocks/Price.vue

183 lines
5.6 KiB

<template>
4 years ago
<div :class="`we-price ${theme} ${(price == 0) ? 'zero-label' : ''}`">
4 years ago
<div v-if="original_price && original_price != 0" class="discount">
<div class="number-original En Bold" > {{ Intl.NumberFormat().format(Number(original_price)) }} </div>
<div class="percent En Bold"> 12 <v-icon color="white"> WMi-percentage</v-icon> </div>
</div>
4 years ago
<div v-if="top_label" class="label top Fa" v-html="top_label"></div>
<!----------------------------Main Value------------------------->
<div v-if="(price != 0 || !zeroLabel)" class="number En Bold">
4 years ago
<v-icon v-if="prepend_icon" class="prepend-icon">WMi-{{ prepend_icon}} </v-icon>
4 years ago
{{ Intl.NumberFormat().format(price) }}
4 years ago
<v-icon v-if="append_icon" class="append-icon">WMi-{{ append_icon }} </v-icon>
4 years ago
</div>
<!----------------------------Main Value------------------------->
4 years ago
<div v-else class="text--24 Fa Bold"> {{ zeroLabel }} </div>
<div class="label Fa" v-html="label"></div>
</div>
</template>
<script>
export default {
props: {
theme: { default: '' },
original_price: { default: 0 },
4 years ago
price: { default: 1000 },
label: { default: 'تومان' },
4 years ago
zeroLabel: String,
4 years ago
top_label: String,
direction: String,
4 years ago
prepend_icon: String,
append_icon: String,
},
};
</script>
<style lang="scss" scoped>
.we-price {
transition: 0.2s;
border: 1px solid transparent;
border-radius: 5px;
text-align: center;
padding: 5px 15px;
}
4 years ago
.we-price.left-align {
text-align: left;
}
.we-price .number {
font-size: 25px;
line-height: 20px;
4 years ago
direction: ltr;
}
4 years ago
.we-price .prepend-icon, .we-price .append-icon {
4 years ago
margin-right: -10px;
margin-left: -10px;
4 years ago
font-size: 18px;
}
.we-price .discount {
display: flex;
justify-content: space-between;
align-items: flex-end;
margin-bottom: 3px;
}
.we-price .discount .percent {
background-color: var(--color-red);
border-radius: 5px;
border-top-left-radius: 0px;
padding: 0px 5px 0px 2px;
color: var(--color-white);
font-size: 14px;
}
.we-price .discount .percent .v-icon {
margin-top: -3px;
margin-right: -5px;
font-size: 12px;
}
.we-price .number-original {
font-size: 12px;
line-height: 10px;
color: var(--color-red);
text-decoration: line-through;
text-align: right;
}
.we-price .label {
font-size: 12px;
opacity: 0.7;
text-align: left;
}
4 years ago
.we-price .label.top {
text-align: right;
}
4 years ago
/*----------------------------------------------------*/
/* Zero Label */
/*----------------------------------------------------*/
.we-price.zero-label .label {
display: none;
}
.we-price.zero-label .number-original {
text-decoration: none;
}
/*----------------------------------------------------*/
/* Misc */
/*----------------------------------------------------*/
.we-price.line-through .number {
text-decoration: line-through;
}
.we-price.label-left {
display: flex;
align-items: baseline;
}
/*----------------------------------------------------*/
/* Lg Size */
/*----------------------------------------------------*/
.we-price.lg .number {
font-size: 32px;
line-height: 25px;
}
4 years ago
/*----------------------------------------------------*/
/* MD Size */
/*----------------------------------------------------*/
.we-price.md {
transform: scale(0.8, 0.8);
}
4 years ago
/*----------------------------------------------------*/
/* SM Size */
/*----------------------------------------------------*/
.we-price.sm .number {
font-size: 20px;
line-height: 15px;
}
.we-price.sm .percent {
display: none;
}
.we-price.sm .label {
font-size: 11px;
line-height: 10px;
margin-top: 2px;
display: none;
}
/*----------------------------------------------------*/
/* Colors */
/*----------------------------------------------------*/
@import "resources/js/Global/scss/_vars.scss";
@each $color,
$value in $colors {
4 years ago
.we-price.theme-#{$color} .discount .percent {
background-color: $value;
}
.we-price.theme-#{$color} .number-original {
color: $value;
}
4 years ago
.we-price.theme-#{$color}-full .number, .we-price.theme-#{$color}-full .label, .we-price.theme-#{$color}-full .prepend-icon, .we-price.theme-#{$color}-full .append-icon {
4 years ago
color: $value;
}
4 years ago
.we-price.border-#{$color} {
border: 1px solid $value;
}
.we-price.border-left-#{$color} {
border-left: 3px solid $value;
border-radius: 0px 5px 5px 0px;
}
}
@each $backgroundColor,
$value in $backgrounds {
.we-price.bg-#{$backgroundColor} {
background-color: $value;
}
}
</style>