Skip to content

Commit

Permalink
Update swatch selected filter data
Browse files Browse the repository at this point in the history
  • Loading branch information
Jade-GG committed Jan 24, 2025
1 parent c46fd75 commit 4a7571b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions resources/js/components/Listing/Listing.vue
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,9 @@ export default {
}))
},
withSwatches(items, filterCode) {
withSwatches(items, filter) {
return items.map((item) => ({
swatch: this.$root.swatches[filterCode]?.options?.[item.value] ?? null,
swatch: this.$root.swatches[filter.base_code]?.options?.[item.value] ?? null,
...item,
}))
},
Expand Down
2 changes: 1 addition & 1 deletion resources/views/listing/partials/filter/selected.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class="text-sm text-muted transition-all hover:underline"
<template v-for="item in withFilters(items)">
<li
class="flex flex-wrap gap-2 relative"
v-for="refinement in item.refinements"
v-for="refinement in withSwatches(item.refinements, item.filter)"
:key="[
refinement.attribute,
refinement.type,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{-- TODO: Display swatches correctly here --}}

<template v-else-if="item.filter.input === 'swatch'">
@{{ refinement.label }}
<template v-else-if="item.filter.super">
@{{ refinement.swatch.label }}
</template>
2 changes: 1 addition & 1 deletion resources/views/listing/partials/filter/swatch.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div v-show="items.length" class="relative pb-4">
<x-rapidez::filter.heading>
<ul class="flex flex-wrap gap-2 items-center my-1">
<li v-for="item in withSwatches(items, filter.base_code)">
<li v-for="item in withSwatches(items, filter)">
<label
v-if="filter.visual_swatch"
class="size-6 ring-1 ring-emphasis/10 ring-inset cursor-pointer flex items-center justify-center hover:opacity-75 rounded-full transition"
Expand Down

0 comments on commit 4a7571b

Please sign in to comment.