Let's say I have a reusable module for custom dropdown elements:
class Dropdown extends Module {
static base = {
$("p-dropdown")
}
}
and I have a page, with a 'modal' added to it. This modal has multiple dropdowns.
Each modal has its own identifier. What would be the best practice to add this to the content?
I do not wish to create additional classes for each type of dropdown that extends the Dropdown class above.
class customModal extends Module {
static base = { $(".modal.is-active") }
static content = {
body(wait: true) {$(".modal-card-body")}
nationalityDropdown(wait: true) { body.find("#nationalityDropdown").module(Dropdown) }
genderDropdown(wait: true) { body.find("#genderDropdown").module(Dropdown) }
}
}
(note: the naming is altered to keep it simple. Not exact code in project.)
What would be perfect if I could add content to my customModal something like this:
nationalityDropdown(wait: true) { module(Dropdown).where{ id: "nationalityDropdown") } }