Skip to content

Commit bf970f7

Browse files
committed
Replace div with template
1 parent 9838d55 commit bf970f7

File tree

1 file changed

+16
-38
lines changed

1 file changed

+16
-38
lines changed

components/Products/ProductsShowAll.vue

Lines changed: 16 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,13 @@
11
<template>
2-
<div v-if="allCategoryProducts?.productCategory?.products?.nodes">
2+
<template v-if="allCategoryProducts?.productCategory?.products?.nodes">
33
<section>
44
<div id="product-container" class="flex flex-wrap items-center">
5-
<template
6-
v-for="product in allCategoryProducts.productCategory.products.nodes"
7-
>
8-
<div
9-
v-if="product.slug"
10-
:key="product.id"
11-
class="flex flex-col mt-6 sm:w1/2 md:w-1/3 lg:w-1/4 lg:mr-4"
12-
>
13-
<NuxtLink
14-
class="text-black cursor-pointer hover:underline"
15-
:to="{
16-
path: '/product/' + product.slug,
17-
query: { id: product.databaseId },
18-
}"
19-
>
5+
<template v-for="product in allCategoryProducts.productCategory.products.nodes">
6+
<div v-if="product.slug" :key="product.id" class="flex flex-col mt-6 sm:w1/2 md:w-1/3 lg:w-1/4 lg:mr-4">
7+
<NuxtLink class="text-black cursor-pointer hover:underline" :to="{
8+
path: '/product/' + product.slug,
9+
query: { id: product.databaseId },
10+
}">
2011
<ProductImage :alt="product.name" :src="productImage(product)" />
2112

2213
<div class="flex justify-center pt-3">
@@ -28,14 +19,12 @@
2819
<div v-if="product.onSale" class="flex justify-center mt-2">
2920
<div class="text-lg text-gray-900 line-through">
3021
<span v-if="product.variations">
31-
{{ filteredVariantPrice(product.price, "right") }}</span
32-
>
22+
{{ filteredVariantPrice(product.price, "right") }}</span>
3323
<span v-else>{{ product.regularPrice }}</span>
3424
</div>
3525
<div class="ml-4 text-xl text-gray-900">
3626
<span v-if="product.variations">
37-
{{ filteredVariantPrice(product.price) }}</span
38-
>
27+
{{ filteredVariantPrice(product.price) }}</span>
3928
<span v-else>{{ product.salePrice }}</span>
4029
</div>
4130
</div>
@@ -48,35 +37,24 @@
4837
</template>
4938
</div>
5039
</section>
51-
</div>
40+
</template>
5241
<div v-else>
5342
<section>
5443
<div id="product-container" class="flex flex-wrap items-center">
5544
<template v-for="product in allProducts.products.nodes">
56-
<div
57-
v-if="product.slug"
58-
:key="product.id"
59-
class="flex flex-col mt-6 sm:w1/2 md:w-1/3 lg:w-1/4 lg:mr-4"
60-
>
61-
<NuxtLink
62-
class="text-black cursor-pointer hover:underline"
63-
:to="{
64-
path: '/product/' + product.slug,
65-
query: { id: product.databaseId },
66-
}"
67-
>
45+
<div v-if="product.slug" :key="product.id" class="flex flex-col mt-6 sm:w1/2 md:w-1/3 lg:w-1/4 lg:mr-4">
46+
<NuxtLink class="text-black cursor-pointer hover:underline" :to="{
47+
path: '/product/' + product.slug,
48+
query: { id: product.databaseId },
49+
}">
6850
<ProductImage :alt="product.name" :src="productImage(product)" />
6951
<div class="flex justify-center pt-3">
7052
<p class="text-2xl font-bold text-center cursor-pointer">
7153
{{ product.name }}
7254
</p>
7355
</div>
7456
</NuxtLink>
75-
<ProductPrice
76-
:product="product"
77-
priceFontSize="normal"
78-
:shouldCenterPrice="true"
79-
/>
57+
<ProductPrice :product="product" priceFontSize="normal" :shouldCenterPrice="true" />
8058
</div>
8159
</template>
8260
</div>

0 commit comments

Comments
 (0)