feat: Replace sort buttons with dropdown and update listener
This commit is contained in:
1 parent
5233797bb4
commit
7f6e016bd9
1 file changed
+5
-18
@@ -162,18 +162,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
btn.classList.remove('border-primary', 'bg-primary/10');
|
||||
}
|
||||
});
|
||||
sortButtons.forEach(btn => {
|
||||
const isActive = btn.dataset.sortBy === currentSort;
|
||||
btn.classList.toggle('active', isActive);
|
||||
// Make active sort button slightly darker (using primary-dark)
|
||||
if (isActive) {
|
||||
btn.classList.remove('bg-primary');
|
||||
btn.classList.add('bg-primary-dark');
|
||||
} else {
|
||||
btn.classList.remove('bg-primary-dark');
|
||||
btn.classList.add('bg-primary');
|
||||
}
|
||||
});
|
||||
// No active state styling needed for select dropdown itself
|
||||
}
|
||||
|
||||
// Event Listeners for Filter Buttons
|
||||
@@ -184,12 +173,10 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
});
|
||||
});
|
||||
|
||||
// Event Listeners for Sort Buttons
|
||||
sortButtons.forEach(button => {
|
||||
button.addEventListener('click', () => {
|
||||
currentSort = button.dataset.sortBy;
|
||||
applyFiltersAndSorting();
|
||||
});
|
||||
// Event Listener for Sort Dropdown
|
||||
sortSelect.addEventListener('change', (event) => {
|
||||
currentSort = event.target.value;
|
||||
applyFiltersAndSorting();
|
||||
});
|
||||
|
||||
// Initial application of filters and sorting on page load
|
||||
|
||||
Reference in new issue
Block a user