Skip to content

Commit 17f7177

Browse files
authored
Refactor (#7)
* update JS script * added comments to server * updated dashboard layout * Refactor index for a better template design * Added a better design for the footer * refactor the header file for better setting randering * large refactor and update for the styling of the template * Added source code link * Updated demo screenshot images
1 parent 83e1438 commit 17f7177

File tree

11 files changed

+606
-186
lines changed

11 files changed

+606
-186
lines changed

assets/dashboard.png

59.7 KB
Loading

assets/homepage.png

30.9 KB
Loading

assets/login.png

2.37 KB
Loading

assets/menu.js

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,24 @@ function settings() {
55
}
66

77
// Close the dropdown menu if the user clicks outside of it
8-
window.onclick = function(event) {
9-
if (!event.target.matches('.dropbtn')) {
10-
var dropdowns = document.getElementsByClassName("dropdown-content");
11-
for (var i = 0; i < dropdowns.length; i++) {
12-
var openDropdown = dropdowns[i];
13-
if (openDropdown.classList.contains('show')) {
14-
openDropdown.classList.remove('show');
15-
}
8+
document.addEventListener('DOMContentLoaded', () => {
9+
const btn = document.querySelector('.dropdown .dropbtn');
10+
const menu = document.getElementById('setting');
11+
if (!btn || !menu) return;
12+
13+
btn.addEventListener('click', () => {
14+
const expanded = btn.getAttribute('aria-expanded') === 'true';
15+
btn.setAttribute('aria-expanded', String(!expanded));
16+
menu.hidden = expanded;
17+
});
18+
19+
document.addEventListener('click', (e) => {
20+
if (!menu.hidden && !e.target.closest('.dropdown')) {
21+
btn.setAttribute('aria-expanded', 'false');
22+
menu.hidden = true;
1623
}
17-
}
18-
}
24+
});
25+
});
1926

2027
/*
2128
setmenu() function is used to set menu items dynamically
@@ -114,4 +121,4 @@ function validatePassword() {
114121
} else {
115122
passwordMatchCheck.textContent = '✗';
116123
}
117-
}
124+
}

assets/register.png

4.67 KB
Loading

0 commit comments

Comments
 (0)