2 changed files with 47 additions and 12 deletions
@ -0,0 +1,19 @@ |
|||||||
|
import { Controller } from "@hotwired/stimulus"; |
||||||
|
|
||||||
|
export default class extends Controller { |
||||||
|
static targets = ["preview", "full", "button"]; |
||||||
|
|
||||||
|
toggle(event) { |
||||||
|
event?.preventDefault?.(); |
||||||
|
if (this.fullTarget.style.display === "none") { |
||||||
|
this.fullTarget.style.display = ""; |
||||||
|
this.previewTarget.style.display = "none"; |
||||||
|
this.buttonTarget.textContent = "Show less"; |
||||||
|
} else { |
||||||
|
this.fullTarget.style.display = "none"; |
||||||
|
this.previewTarget.style.display = ""; |
||||||
|
this.buttonTarget.textContent = "Show more"; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
Loading…
Reference in new issue