-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
52 lines (43 loc) · 1.45 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
const sideMenu = document.querySelector("aside");
const menuBtn = document.querySelector("#menu-btn");
const closeBtn = document.querySelector("#close-btn");
const themeToggler = document.querySelector(".theme-toggler");
menuBtn.addEventListener("click", () => {
sideMenu.style.display = "block";
});
closeBtn.addEventListener("click", () => {
sideMenu.style.display = "none";
});
themeToggler.addEventListener("click", () => {
document.body.classList.toggle("dark-theme-variables");
themeToggler.querySelector("span:nth-child(1)").classList.toggle("active");
themeToggler.querySelector("span:nth-child(2)").classList.toggle("active");
});
// Fill orders in table
Orders.forEach((order) => {
const tr = document.createElement("tr");
const trContent = `
<td>${order.productName}</td>
<td>${order.productNumber}</td>
<td>${order.paymentStatus}</td>
<td class="${
order.shipping === "Declined"
? "danger"
: order.shipping === "Pending"
? "warning"
: "primary"
}">${order.shipping}</td>
<td class="primary">Details</td>
`;
tr.innerHTML = trContent;
document.querySelector("table tbody").appendChild(tr);
});
// function handleTabletChange(e) {
// // Check if the media query is true
// if (e.matches) {
// sideMenu.style.display = "block";
// }
// }
// const mediaQuery = window.matchMedia('(min-width: 768px)')
// // Register event listener
// mediaQuery.addListener(handleTabletChange)