|
1 | 1 | <template>
|
2 | 2 | <div class="w-full md:w-1/4 p-4">
|
3 |
| - <h3 class="text-lg font-bold mb-2">Product Type</h3> |
4 |
| - <div v-for="productType in store.productTypes" :key="productType.id"> |
5 |
| - <input |
6 |
| - type="checkbox" |
7 |
| - :id="productType.id" |
8 |
| - :checked="productType.checked" |
9 |
| - @change="store.toggleProductType(productType.id)" |
10 |
| - /> |
11 |
| - <label :for="productType.id" class="ml-2">{{ productType.name }}</label> |
| 3 | + <h2 class="text-lg font-bold mb-4">Filters</h2> |
| 4 | + <div> |
| 5 | + <h3 class="text-md font-semibold mb-2">Product Type</h3> |
| 6 | + <div> |
| 7 | + <input type="checkbox" id="clothing" /> |
| 8 | + <label for="clothing" class="ml-2">Clothing</label> |
| 9 | + </div> |
| 10 | + <div> |
| 11 | + <input type="checkbox" id="tshirts" /> |
| 12 | + <label for="tshirts" class="ml-2">T-shirts</label> |
| 13 | + </div> |
| 14 | + <div> |
| 15 | + <input type="checkbox" id="uncategorized" /> |
| 16 | + <label for="uncategorized" class="ml-2">Uncategorized</label> |
| 17 | + </div> |
12 | 18 | </div>
|
13 |
| - |
14 |
| - <h3 class="text-lg font-bold mt-4 mb-2">Price</h3> |
15 |
| - <div class="flex items-center" v-if="store.priceRange"> |
16 |
| - <input |
17 |
| - type="range" |
18 |
| - min="0" |
19 |
| - max="1000" |
20 |
| - :value="store.priceRange[0]" |
21 |
| - @input="updatePriceRange($event, 0)" |
22 |
| - class="w-full" |
23 |
| - /> |
24 |
| - <span class="mx-2">{{ store.priceRange[0] }}</span> |
25 |
| - <span>-</span> |
26 |
| - <input |
27 |
| - type="range" |
28 |
| - min="0" |
29 |
| - max="1000" |
30 |
| - :value="store.priceRange[1]" |
31 |
| - @input="updatePriceRange($event, 1)" |
32 |
| - class="w-full" |
33 |
| - /> |
34 |
| - <span class="ml-2">{{ store.priceRange[1] }}</span> |
| 19 | + <div class="mt-4"> |
| 20 | + <h3 class="text-md font-semibold mb-2">Price</h3> |
| 21 | + <div class="flex items-center"> |
| 22 | + <input type="range" min="0" max="1000" class="w-full" /> |
| 23 | + </div> |
35 | 24 | </div>
|
36 |
| - |
37 |
| - <button |
38 |
| - @click="store.resetFilters()" |
39 |
| - class="mt-4 bg-gray-200 px-4 py-2 rounded" |
40 |
| - > |
| 25 | + <div class="mt-4"> |
| 26 | + <h3 class="text-md font-semibold mb-2">Size</h3> |
| 27 | + <div> |
| 28 | + <input type="checkbox" id="large" /> |
| 29 | + <label for="large" class="ml-2">Large</label> |
| 30 | + </div> |
| 31 | + </div> |
| 32 | + <div class="mt-4"> |
| 33 | + <h3 class="text-md font-semibold mb-2">Color</h3> |
| 34 | + <div> |
| 35 | + <input type="radio" id="blue" name="color" /> |
| 36 | + <label for="blue" class="ml-2">Blue</label> |
| 37 | + </div> |
| 38 | + </div> |
| 39 | + <button class="mt-4 bg-gray-200 px-4 py-2 rounded"> |
41 | 40 | Reset Filter
|
42 | 41 | </button>
|
43 | 42 | </div>
|
44 | 43 | </template>
|
45 |
| - |
46 |
| -<script setup> |
47 |
| -import { useProductsStore } from "@/store/useProductsStore"; |
48 |
| -
|
49 |
| -const store = useProductsStore(); |
50 |
| -
|
51 |
| -const updatePriceRange = (event, index) => { |
52 |
| - const newRange = [...store.priceRange]; |
53 |
| - newRange[index] = parseInt(event.target.value, 10); |
54 |
| - store.setPriceRange(newRange); |
55 |
| -}; |
56 |
| -</script> |
0 commit comments