import { Controller } from "@hotwired/stimulus"

export default class ModalController extends Controller {
    static targets = ['close', 'modal'];

    current(id) {
        return this.modalTargets.find(m => m.getAttribute('data-id') === id);
    }

    open() {
        console.log('Modal: I am triggered...');
        this.modalTarget.classList.add('is-active');
    }

    close() {
        this.modalTarget.classList.remove('is-active');
    }
}
