-
Notifications
You must be signed in to change notification settings - Fork 1
/
sideBar.js
32 lines (27 loc) · 860 Bytes
/
sideBar.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
const sideBar = document.getElementById('sideBar');
const folder = document.createElement('button');
let fsVisibility = true;
fetch('./symbols.json')
.then(response => response.json())
.then(data => {
folder.innerHTML = data['sideFolder'];
})
.catch(error => console.log('Error fetching data:', error));
folder.className = 'folder';
folder.title = 'Workspace';
folder.style.borderLeft = 'solid 2px #959cbd';
folder.addEventListener('click', () => {
const fs = document.getElementById('fs');
if (fsVisibility) {
folder.style.borderLeft = 'solid 0px';
fs.style.width = '0px';
fs.style.borderWidth = '0px';
} else {
folder.style.borderLeft = 'solid 2px #959cbd';
fs.style.width = '200px';
fs.style.borderWidth = '3px';
}
fsVisibility = !fsVisibility;
});
// Append button to sidebar
sideBar.appendChild(folder);