Turn filter chips into links

This commit is contained in:
Jose Farias
2024-11-18 11:34:44 -06:00
parent 85e008e31d
commit 0995eee074
5 changed files with 34 additions and 33 deletions
@@ -1,17 +1,6 @@
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static targets = [ "chip" ]
connect() {
this.chipTargets.forEach(button => this.#showChip(button))
}
removeFilter(event) {
event.preventDefault()
this.#hideChip(event.target.closest("button"))
}
clearCategory({ params: { name } }) {
name.split(",").forEach(name => {
this.element.querySelectorAll(`input[name="${name}"]`).forEach(input => {
@@ -19,14 +8,4 @@ export default class extends Controller {
})
})
}
#showChip(button) {
button.querySelector("input").disabled = false
button.hidden = false
}
#hideChip(button) {
button.querySelector("input").disabled = true
button.hidden = true
}
}