80 lines
2.0 KiB
Vue
80 lines
2.0 KiB
Vue
<template>
|
||
<div class="index">
|
||
<div v-if="productCardData.length" class="cards-list">
|
||
<div
|
||
v-for="product in pizda"
|
||
:key="product.id"
|
||
class="card"
|
||
@click="router.push(`/product/${product.id}`)"
|
||
>
|
||
<img class="card__image" :src="product?.images?.[0]?.src" alt="card?.image">
|
||
|
||
<div class="card__description">
|
||
<div>{{ product?.name }}</div>
|
||
|
||
<div class="d-flex align-items-center">
|
||
{{ product?.price }}
|
||
<Icon name="ph:currency-rub" />
|
||
</div>
|
||
|
||
<div v-if="product?.colors?.length > 1">
|
||
{{ `+${product?.colors?.length} Цвета` }}
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<script setup lang="ts">
|
||
import { useProductsList } from '~/composables'
|
||
|
||
const { productCardData } = useProductsList()
|
||
|
||
// Карточка вариативного товара с разными цветами в процессе разработки, поэтому отображаем только карточку товара с одним цветов
|
||
const pizda = computed(() => {
|
||
return [productCardData.value.find(xueta => xueta.name === 'Пальто мужское'), productCardData.value.find(xueta => xueta.name === 'Пальто мужское'), productCardData.value.find(xueta => xueta.name === 'Пальто мужское'), productCardData.value.find(xueta => xueta.name === 'Пальто мужское')]
|
||
})
|
||
const router = useRouter()
|
||
</script>
|
||
|
||
<style lang="scss">
|
||
.cards-list {
|
||
padding: 15px;
|
||
|
||
display: grid;
|
||
grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
|
||
gap: 30px 4px;
|
||
|
||
@include mobile {
|
||
grid-template-columns: repeat(2, 1fr);
|
||
gap: 10px;
|
||
padding: 10px;
|
||
}
|
||
}
|
||
|
||
.card {
|
||
display: flex;
|
||
flex-direction: column;
|
||
cursor: pointer;
|
||
|
||
@include mobile {
|
||
min-width: auto;
|
||
}
|
||
|
||
&__image {
|
||
width: 100%;
|
||
height: auto;
|
||
}
|
||
|
||
&__description {
|
||
padding: 10px 5px;
|
||
|
||
@include mobile {
|
||
padding: 8px 4px;
|
||
font-size: 14px;
|
||
}
|
||
}
|
||
}
|
||
</style>
|