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