Skip to content

Commit e32aebf

Browse files
committed
add: progress made on difficulty dropdown class
1 parent 6816d75 commit e32aebf

File tree

1 file changed

+53
-1
lines changed

1 file changed

+53
-1
lines changed

options/difficulyDropdown.js

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,57 @@ class DifficultyDropdown {
55
this.onChange = onChange;
66
this.selectedDifficulty = 'all';
77
this.filteredDifficulties = ['all', ...difficulties];
8+
this.createDropdown();
89
}
9-
}
10+
11+
createDropdown() {
12+
this.container.innerHTML = '';
13+
this.dropdown = document.createElement('div');
14+
this.dropdown.className = 'difficulty-dropdown';
15+
16+
this.selected = document.createElement('div');
17+
this.selected.className = 'difficulty-dropdown-selected';
18+
this.selected.tabIndex = 0;
19+
20+
const selectedText = document.createElement('span');
21+
selectedText.className = 'difficulty-dropdown-selected-text';
22+
selectedText.textContent = 'All Difficulties';
23+
this.selected.appendChild(selectedText);
24+
const chevron = document.createElement('i');
25+
chevron.className = 'ri-arrow-down-s-line difficulty-dropdown-chevron'
26+
this.selected.appendChild(chevron);
27+
this.selected.addEventListener('click', () => this.toggleList());
28+
this.selected.addEventListener('keydown', (e) => {
29+
if (e.key == 'Enter' || e.key == ' ') this.toggleList();
30+
});
31+
this.dropdown.appendChild(this.selected);
32+
33+
this.list = document.createElement('div');
34+
}
35+
36+
renderOptions() {
37+
// TODO: Finish function
38+
}
39+
40+
filterDifficulties() {
41+
// TODO: Finish function
42+
}
43+
44+
selectDifficulty(tag) {
45+
// TODO: Finish function
46+
}
47+
48+
toggleList() {
49+
// TODO: Finish function
50+
}
51+
52+
closeList() {
53+
54+
}
55+
56+
selectDifficulty() {
57+
58+
}
59+
60+
}
61+
window.DifficultyDropdown = DifficultyDropdown;

0 commit comments

Comments
 (0)