feat(components): add offcanvas component

This commit is contained in:
Alexander Navarro 2024-12-26 19:49:08 -03:00
parent e0ed5a5ddd
commit c47a2eff89
14 changed files with 233 additions and 129 deletions

View file

@ -0,0 +1,21 @@
import { qs, qsa } from "../utils";
window.onload = () => {
qsa(".msp-offcanvas-toggle").forEach((item) => {
item.addEventListener("click", () => {
const target = item.dataset.mspTarget;
if (!target) {
throw new Error("No target provided");
}
const targetElement = qs(target);
if (!targetElement) {
throw new Error("No target found");
}
targetElement.classList.toggle("show");
});
});
};