File tree Expand file tree Collapse file tree 1 file changed +29
-19
lines changed Expand file tree Collapse file tree 1 file changed +29
-19
lines changed Original file line number Diff line number Diff line change 4
4
</div >
5
5
6
6
<div class =" mt-8 grid grid-cols-1 gap-y-12 sm:grid-cols-2 sm:gap-x-6 lg:grid-cols-4 xl:gap-x-8 mb-32" >
7
- <div v-for =" (product, index) in products" >
7
+ <div
8
+ v-for =" (product, index) in products"
9
+ class =" h-full flex flex-col"
10
+ >
8
11
<div
9
12
:index =" index"
10
13
class =" relative"
16
19
<div class =" relative mt-4" >
17
20
<h3 class =" text-sm font-medium" >{{ product.name }}</h3 >
18
21
<p class =" mt-1 text-sm text-zinc-500" >{{ product.description }}</p >
19
- <p class =" mt-3 text-xs text-zinc-500" >{{ product.stock }} left in stock</p >
20
22
</div >
21
23
<div class =" absolute inset-x-0 top-0 flex h-72 items-end justify-end overflow-hidden rounded-lg p-4" >
22
24
<div class =" absolute inset-x-0 bottom-0 h-36 bg-gradient-to-t from-black opacity-50" ></div >
23
25
<p class =" relative text-lg font-semibold text-white" >🥔 {{ product.price }}</p >
24
26
</div >
25
27
</div >
26
- <div class =" mt-6" >
27
- <template v-if =" product .stock > 0 " >
28
- <button
29
- class =" relative w-full flex items-center justify-center rounded-md border border-zinc-300 bg-zinc-100 py-2 px-8 text-sm font-medium text-gray-900"
30
- @click =" openModal(product)"
31
- >
32
- I want this
33
- </button >
34
- </template >
35
- <template v-else >
36
- <button
37
- class =" relative w-full flex items-center justify-center rounded-md border border-transparent bg-zinc-500 py-2 px-8 text-sm font-medium text-gray-900"
38
- disabled
39
- >
40
- Out of stock
41
- </button >
42
- </template >
28
+ <div class =" mt-auto" >
29
+ <p
30
+ v-if =" product.stock >= 1"
31
+ class =" mt-6 text-xs text-zinc-500"
32
+ >
33
+ {{ product.stock }} left in stock
34
+ </p >
35
+ <div class =" mt-3" >
36
+ <template v-if =" product .stock > 0 " >
37
+ <button
38
+ class =" relative w-full flex items-center justify-center rounded-md border border-zinc-300 bg-zinc-100 py-2 px-8 text-sm font-medium text-gray-900"
39
+ @click =" openModal(product)"
40
+ >
41
+ I want this
42
+ </button >
43
+ </template >
44
+ <template v-else >
45
+ <button
46
+ class =" relative w-full flex items-center justify-center rounded-md border border-transparent bg-zinc-500 py-2 px-8 text-sm font-medium text-gray-900"
47
+ disabled
48
+ >
49
+ Out of stock
50
+ </button >
51
+ </template >
52
+ </div >
43
53
</div >
44
54
</div >
45
55
</div >
You can’t perform that action at this time.
0 commit comments