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/ImageSelect.vue

141 lines
3.6 KiB

5 years ago
<template>
<v-row>
<v-col v-for="(item, i) in items" :key="i" class="image-select" @click="changeSelected(item)" :class="`${size} pa-1`">
4 years ago
<div :class="{'active': isActive(item), 'item': true, 'selected': (i == 2)}">
<img class="thumbnail width-full" :src="item[itemSrc]"/>
5 years ago
<div class="name">
<div class="content">
<div class="Fa"> {{ item[itemText] }}</div>
<div class="En"> {{ item[itemTextEn] }}</div>
5 years ago
</div>
</div>
<div class="icon-wrapper">
<v-icon class="WMi-ok" color="white"></v-icon>
</div>
5 years ago
</div>
</v-col>
</v-row>
</template>
<script>
export default {
props: {
size: {default: "col-xl-2"},
items: {default: []},
itemValue: {default: 'id'},
itemText: {default: 'name'},
itemTextEn: {default: 'name_en'},
itemSrc: {default: 'src'},
value: {default: ''}
5 years ago
},
data: () => ({
thumbnail: "images/Business/Items/iPhoneX.jpg",
5 years ago
}),
computed: {
currentSelect: {
get() {
return this.value;
},
set(value) {
this.$emit('input', value);
}
}
},
methods: {
isActive(item) {
return item[this.itemValue] === this.value;
},
changeSelected(item) {
this.currentSelect = item[this.itemValue];
}
}
5 years ago
};
</script>
<style lang="scss" scoped>
4 years ago
.no-en .content .En {
display: none;
}
.en-ltr-0 .image-select .item .name .En {
letter-spacing: 0px;
}
5 years ago
.image-select {
}
.image-select .item {
position: relative;
border: 1px solid transparent;
transition: 0.2s;
cursor: pointer;
}
5 years ago
.image-select .item .icon-wrapper {
display: none;
background-color: var(--color-blue);
text-align: center;
justify-content: center;
color: #fff;
}
5 years ago
.image-select .item.selected {
border: 1px solid var(--color-blue);
}
5 years ago
.image-select .item.selected .icon-wrapper {
display: flex;
position: absolute;
right: 0px;
bottom: 0px;
}
5 years ago
.image-select .item .thumbnail {
position: relative;
}
5 years ago
.image-select .item .name {
display: flex;
position: absolute;
width: 100%;
height: 100%;
5 years ago
color: #fff;
right: 0px;
top: 0px;
visibility: hidden;
opacity: 0;
transition: visibility 0s, opacity 0.2s linear;
background-color: rgba(0, 0, 0, 0.8);
5 years ago
justify-content: center;
align-items: center;
text-align: center;
}
5 years ago
.image-select .item .name .Fa {
font-size: 18px;
4 years ago
line-height: 24px;
5 years ago
}
5 years ago
.image-select .item .name .En {
font-size: 12px;
4 years ago
line-height: 18px;
5 years ago
letter-spacing: 5px;
text-transform: uppercase;
opacity: 0.8;
}
.image-select .item:hover, .image-select .item.active {
5 years ago
border: 1px solid #2f353b;
/*padding: 5px;*/
5 years ago
}
.image-select .item:hover .thumbnail, .image-select .item.active .thumbnail {
5 years ago
-webkit-filter: grayscale(0%);
}
.image-select .item:hover .name, .image-select .item.active .name {
5 years ago
visibility: visible;
opacity: 1;
width: 100%;
height: 100%;
5 years ago
}
4 years ago
5 years ago
</style>