Skip to content

Commit 9c07434

Browse files
authored
ref(frontend): Improve product description styles (#107)
1 parent 06dc1da commit 9c07434

File tree

1 file changed

+29
-19
lines changed

1 file changed

+29
-19
lines changed

frontend/src/views/Shop.vue

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
</div>
55

66
<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+
>
811
<div
912
:index="index"
1013
class="relative"
@@ -16,30 +19,37 @@
1619
<div class="relative mt-4">
1720
<h3 class="text-sm font-medium">{{ product.name }}</h3>
1821
<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>
2022
</div>
2123
<div class="absolute inset-x-0 top-0 flex h-72 items-end justify-end overflow-hidden rounded-lg p-4">
2224
<div class="absolute inset-x-0 bottom-0 h-36 bg-gradient-to-t from-black opacity-50"></div>
2325
<p class="relative text-lg font-semibold text-white">🥔 {{ product.price }}</p>
2426
</div>
2527
</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>
4353
</div>
4454
</div>
4555
</div>

0 commit comments

Comments
 (0)