clone of github.com/decent-newsroom/newsroom
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

19 lines
612 B

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";
}
}
}