1import { Controller } from '@hotwired/stimulus' 2 3// Connects to data-controller='homepage--recovery-showcase' 4export default class extends Controller { 5 static targets = ['bikePhoto', 'next', 'prev', 'slide'] 6 static values = { currentIndex: { type: Number, default: 0 } } 7 8 connect () { 9 this.slidesCount = this.slideTargets.length 10 } 11 12 next () { 13 this.goToSlide((this.currentIndexValue + 1) % this.slidesCount) 14 } 15 16 prev () { 17 this.goToSlide((this.currentIndexValue - 1 + this.slidesCount) % this.slidesCount) 18 } 19 20 goToSlide (index) { 21 // Hide current slide 22 this.slideTargets[this.currentIndexValue].classList.add('tw:hidden') 23 24 // Update index (this will trigger currentIndexValueChanged if you add that callback) 25 this.currentIndexValue = index 26 27 // Show new slide 28 this.slideTargets[this.currentIndexValue].classList.remove('tw:hidden') 29 30 // Update bike photo 31 this.bikePhotoTarget.src = this.slideTargets[this.currentIndexValue].dataset.imageUrl 32 } 33};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.