mirror of
https://github.com/czhu12/canine.git
synced 2025-12-31 00:10:14 -06:00
16 lines
425 B
JavaScript
16 lines
425 B
JavaScript
import { Controller } from "@hotwired/stimulus"
|
|
|
|
export default class extends Controller {
|
|
static targets = ["input", "icon"]
|
|
|
|
toggle() {
|
|
if (this.inputTarget.type === "password") {
|
|
this.inputTarget.type = "text"
|
|
this.iconTarget.classList.replace("bi-eye", "bi-eye-slash")
|
|
} else {
|
|
this.inputTarget.type = "password"
|
|
this.iconTarget.classList.replace("bi-eye-slash", "bi-eye")
|
|
}
|
|
}
|
|
}
|