|
1 | 1 | <div class="mt-4 space-y-6"> |
2 | 2 | <div class="mt-8"> |
3 | 3 | <ul class="space-y-4"> |
| 4 | + <template x-if="Object.keys($store.cart.items).length === 0"> |
| 5 | + <li class="text-gray-500 text-sm">Your cart is empty.</li> |
| 6 | + </template> |
4 | 7 | <template x-for="(item, key) in $store.cart.items" :key="key"> |
5 | | - <li class="flex items-center gap-4"> |
6 | | - <img :src="item.image" |
7 | | - alt="" |
8 | | - class="size-16 rounded-sm object-cover" /> |
| 8 | + <li class="flex items-center gap-4"> |
| 9 | + <img :src="item.image" alt="" class="size-16 rounded-sm object-cover" /> |
9 | 10 |
|
10 | | - <div> |
11 | | - <h3 class="text-sm text-gray-900" x-text="item.title"></h3> |
12 | | - |
13 | | - <dl class="mt-0.5 space-y-px text-[10px] text-gray-600"> |
14 | | - <div> |
15 | | - <dt class="inline">Size:</dt> |
16 | | - <dd class="inline">XXS</dd> |
17 | | - </div> |
| 11 | + <div> |
| 12 | + <h3 class="text-sm text-gray-900" x-text="item.title"></h3> |
18 | 13 |
|
19 | | - <div> |
20 | | - <dt class="inline">Color:</dt> |
21 | | - <dd class="inline">White</dd> |
22 | | - </div> |
23 | | - </dl> |
24 | | - </div> |
| 14 | + <dl class="mt-0.5 space-y-px text-[10px] text-gray-600"> |
| 15 | + <div> |
| 16 | + <dt class="inline" x-text="`Price: $${item.price.toFixed(2)}`"></dt> |
| 17 | + {{-- <dd class="inline">XXS</dd> --}} |
| 18 | + </div> |
25 | 19 |
|
26 | | - <div class="flex flex-1 items-center justify-end gap-2"> |
27 | | - <form> |
28 | | - <label for="Line1Qty" class="sr-only"> Quantity </label> |
| 20 | + {{-- <div> |
| 21 | + <dt class="inline">Color:</dt> |
| 22 | + <dd class="inline">White</dd> |
| 23 | + </div> --}} |
| 24 | + </dl> |
| 25 | + </div> |
29 | 26 |
|
30 | | - <input type="number" min="1" :value="item.quantity" id="Line1Qty" |
31 | | - class="h-8 w-12 rounded-sm border-gray-200 bg-gray-50 p-0 text-center text-xs text-gray-600" /> |
32 | | - </form> |
| 27 | + <div class="flex flex-1 items-center justify-end gap-2"> |
| 28 | + <form> |
| 29 | + <label for="Line1Qty" class="sr-only"> Quantity </label> |
33 | 30 |
|
34 | | - <button class="text-gray-600 transition hover:text-red-600"> |
35 | | - <span class="sr-only">Remove item</span> |
| 31 | + <select |
| 32 | + @change="$store.cart.updateQuantity(key, +$event.target.value)" |
| 33 | + class="h-8 w-14 rounded-sm border-gray-200 bg-gray-50 p-0 text-center text-xs text-gray-600"> |
| 34 | + <template x-for="qty in 10" :key="qty"> |
| 35 | + <option :value="qty" x-text="qty" :selected="qty === item.quantity"></option> |
| 36 | + </template> |
| 37 | + </select> |
| 38 | + </form> |
36 | 39 |
|
37 | | - <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" |
38 | | - stroke="currentColor" class="size-4"> |
39 | | - <path stroke-linecap="round" stroke-linejoin="round" |
40 | | - d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" /> |
41 | | - </svg> |
42 | | - </button> |
43 | | - </div> |
44 | | - </li> |
| 40 | + <button class="text-gray-600 transition hover:text-red-600 cursor-pointer" |
| 41 | + @click="$store.cart.removeItem(key)" |
| 42 | + > |
| 43 | + <span class="sr-only">Remove item</span> |
| 44 | + |
| 45 | + <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" |
| 46 | + stroke-width="1.5" stroke="currentColor" class="size-4"> |
| 47 | + <path stroke-linecap="round" stroke-linejoin="round" |
| 48 | + d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" /> |
| 49 | + </svg> |
| 50 | + </button> |
| 51 | + </div> |
| 52 | + </li> |
45 | 53 | </template> |
46 | 54 | </ul> |
47 | 55 |
|
48 | 56 | <div class="mt-8 flex justify-end border-t border-gray-100 pt-8"> |
49 | | - <div class="w-screen max-w-lg space-y-4"> |
50 | | - <dl class="space-y-0.5 text-sm text-gray-700"> |
51 | | - <div class="flex justify-between"> |
52 | | - <dt>Subtotal</dt> |
53 | | - <dd x-text="$store.cart.attributes.total"></dd> |
54 | | - </div> |
| 57 | + <template x-if="Object.keys($store.cart.items).length > 0"> |
| 58 | + <div class="w-screen max-w-lg space-y-4"> |
| 59 | + <dl class="space-y-0.5 text-sm text-gray-700"> |
| 60 | + <div class="flex justify-between"> |
| 61 | + <dt>Subtotal</dt> |
| 62 | + <dd x-text="$store.cart.total"></dd> |
| 63 | + </div> |
55 | 64 |
|
56 | | - {{-- <div class="flex justify-between"> |
57 | | - <dt>VAT</dt> |
58 | | - <dd>£25</dd> |
59 | | - </div> |
| 65 | + {{-- <div class="flex justify-between"> |
| 66 | + <dt>VAT</dt> |
| 67 | + <dd>£25</dd> |
| 68 | + </div> |
60 | 69 |
|
61 | | - <div class="flex justify-between"> |
62 | | - <dt>Discount</dt> |
63 | | - <dd>-£20</dd> |
64 | | - </div> --}} |
| 70 | + <div class="flex justify-between"> |
| 71 | + <dt>Discount</dt> |
| 72 | + <dd>-£20</dd> |
| 73 | + </div> --}} |
65 | 74 |
|
66 | | - <div class="flex justify-between !text-base font-medium"> |
67 | | - <dt>Total</dt> |
68 | | - <dd x-text="$store.cart.attributes.total"></dd> |
69 | | - </div> |
70 | | - </dl> |
| 75 | + <div class="flex justify-between !text-base font-medium"> |
| 76 | + <dt>Total</dt> |
| 77 | + <dd x-text="$store.cart.total"></dd> |
| 78 | + </div> |
| 79 | + </dl> |
71 | 80 |
|
72 | | - {{-- <div class="flex justify-end"> |
73 | | - <span |
74 | | - class="inline-flex items-center justify-center rounded-full bg-indigo-100 px-2.5 py-0.5 text-indigo-700"> |
75 | | - <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" |
76 | | - stroke="currentColor" class="-ms-1 me-1.5 size-4"> |
77 | | - <path stroke-linecap="round" stroke-linejoin="round" |
78 | | - d="M16.5 6v.75m0 3v.75m0 3v.75m0 3V18m-9-5.25h5.25M7.5 15h3M3.375 5.25c-.621 0-1.125.504-1.125 1.125v3.026a2.999 2.999 0 010 5.198v3.026c0 .621.504 1.125 1.125 1.125h17.25c.621 0 1.125-.504 1.125-1.125v-3.026a2.999 2.999 0 010-5.198V6.375c0-.621-.504-1.125-1.125-1.125H3.375z" /> |
79 | | - </svg> |
| 81 | + {{-- <div class="flex justify-end"> |
| 82 | + <span |
| 83 | + class="inline-flex items-center justify-center rounded-full bg-indigo-100 px-2.5 py-0.5 text-indigo-700"> |
| 84 | + <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" |
| 85 | + stroke="currentColor" class="-ms-1 me-1.5 size-4"> |
| 86 | + <path stroke-linecap="round" stroke-linejoin="round" |
| 87 | + d="M16.5 6v.75m0 3v.75m0 3v.75m0 3V18m-9-5.25h5.25M7.5 15h3M3.375 5.25c-.621 0-1.125.504-1.125 1.125v3.026a2.999 2.999 0 010 5.198v3.026c0 .621.504 1.125 1.125 1.125h17.25c.621 0 1.125-.504 1.125-1.125v-3.026a2.999 2.999 0 010-5.198V6.375c0-.621-.504-1.125-1.125-1.125H3.375z" /> |
| 88 | + </svg> |
80 | 89 |
|
81 | | - <p class="text-xs whitespace-nowrap">2 Discounts Applied</p> |
82 | | - </span> |
83 | | - </div> --}} |
| 90 | + <p class="text-xs whitespace-nowrap">2 Discounts Applied</p> |
| 91 | + </span> |
| 92 | + </div> --}} |
84 | 93 |
|
85 | | - <div class="flex justify-end"> |
86 | | - <a href="#" |
87 | | - class="block rounded-sm bg-gray-700 px-5 py-3 text-sm text-gray-100 transition hover:bg-gray-600"> |
88 | | - Checkout |
89 | | - </a> |
| 94 | + <div class="flex justify-end"> |
| 95 | + <a href="#" |
| 96 | + class="block rounded-sm bg-gray-700 px-5 py-3 text-sm text-gray-100 transition hover:bg-gray-600"> |
| 97 | + Checkout |
| 98 | + </a> |
| 99 | + </div> |
90 | 100 | </div> |
91 | | - </div> |
| 101 | + </template> |
92 | 102 | </div> |
93 | 103 | </div> |
94 | 104 | </div> |
0 commit comments