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/Inputs/RadioGroup.vue

184 lines
4.7 KiB

<template>
<v-row :class="`radio-group ${theme}`">
<v-col v-for="(item, index) in items" :key="index" :xl="item.size" class="pt-0" @click="changeSelected($event, item || {})">
<div :class="{'active':value ? value == item.id : item.id == currentSelect, [item.theme]: true, ['bubble']: true}">
<div class="body">
<div :class="`icon ${(item.customIconClass) ? item.customIconClass : ''}`">
<v-icon>WMi-{{ item.icon }}</v-icon>
</div>
<div class="text">
<div class="Fa"> {{ item.title_fa }} </div>
<div v-if="item.title_en" class="En"> {{ item.title_en }} </div>
</div>
</div>
<div class="footer mt-2" v-if="item.desc" v-html="item.desc" />
</div>
</v-col>
</v-row>
</template>
<script>
export default {
props: {
items: {},
initialSelect: {default: 1},
value: {default: null},
name: {default: 'default_name'},
theme: String,
},
data() {
return {
currentSelect: this.initialSelect,
}
},
methods: {
changeSelected($event, item) {
this.currentSelect = item.id;
this.$emit('changeState', {'name':this.name,'value':item.value})
this.$emit('input', item.id);
}
}
}
</script>
<style lang="scss" scoped>
.radio-group {
margin: 0px;
}
.bubble {
width: 100%;
border: 2px solid;
border-radius: 20px;
text-align: center;
padding: 12px;
opacity: 0.3;
transition: ease all 0.3s;
cursor: pointer;
margin: 0px;
}
.bubble .body {
display: flex;
justify-content: center;
align-items: center;
width: 100%;
}
.bubble.text-left .body {
padding-left: 30px;
}
.bubble:hover, .bubble.active {
opacity: 1;
}
.bubble .v-icon {
font-size: 50px !important;
line-height: 50px;
margin-top: -5px;
}
.bubble.right {
border-top-right-radius: 0px !important;
}
.bubble.left {
border-top-left-radius: 0px !important;
}
.bubble.text-right .body {
justify-content: start;
}
.bubble.text-right .footer {
text-align: right;
}
.bubble.text-left .body {
justify-content: flex-end;
}
.bubble .body .text {
text-align: right;
}
//------------------------Theme Colors
@import '../../scss/_vars.scss';
@each $Color,
$Value in $colors {
.bubble.theme-#{$Color} {
border-color: $Value;
background-color: #ffe5e9;
color: $Value;
}
.bubble.theme-#{$Color} .v-icon {
color: $Value;
}
}
@each $Color,
$Value in $backgrounds {
.bubble.theme-#{$Color} {
background-color: $Value;
}
}
.bubble .En {
letter-spacing: 5px;
font-size: 10px;
text-transform: uppercase;
margin-right: -5px;
}
.bubble .Fa {
font-size: 18px;
}
.bubble.title-bold .Fa {
font-size: 22px;
font-family: 'iranyekan-extrabold', sans-serif;
}
.bubble .footer {
font-size: 14px;
color: #676767;
}
//------------------------Farsi Title Only
.bubble.fa-only {
padding: 8px;
border-radius: 10px;
border: 1px solid;
}
.bubble.fa-only .text {
margin-right: 5px;
}
.bubble.fa-only .v-icon {
font-size: 20px !important;
line-height: 20px;
}
.bubble.fa-only .Fa {
font-size: 14px !important;
}
.bubble.icon-only {
padding: 6px 4px 2px 4px;
border-radius: 10px;
border: 1px solid;
}
.bubble.icon-only .v-icon {
font-size: 20px !important;
line-height: 20px;
}
//-----------------------------------Shadow hover
.radio-group.shadowed .bubble.theme-black:hover, .radio-group.shadowed .bubble.theme-black.active {
box-shadow: 0 10px 20px 0 rgba(0, 0, 0, 0.2);
}
.radio-group.shadowed .bubble.theme-red:hover, .radio-group.shadowed .bubble.theme-red.active {
box-shadow: 0 10px 20px 0 rgba(238, 53, 82, 0.2);
}
.radio-group.shadowed .bubble.theme-cyan:hover, .radio-group.shadowed .bubble.theme-cyan.active {
box-shadow: 0 10px 20px 0 rgba(57, 197, 210, 0.2);
}
//-----------------------------------Small Padding
.radio-group.sm-pad .col {
padding: 1px;
}
</style>