style: Use primary Tailwind colors for sort buttons

This commit is contained in:
Kerby Martino (aider) committed 2025-05-04 14:51:42 +08:00
1 parent 005cafd0c8
commit 5423ded939
1 file changed
+10 -6
+10 -6
View File
@@ -26,8 +26,8 @@
<!-- Sort By -->
<div class="sort-controls flex items-center space-x-2">
<span class="text-sm font-medium text-gray-700 mr-2">Sort by:</span>
<button data-sort-by="new" class="sort-btn active px-3 py-1 text-sm font-action bg-white border border-gray-300 rounded-md hover:bg-gray-50">New</button>
<button data-sort-by="top" class="sort-btn px-3 py-1 text-sm font-action bg-white border border-gray-300 rounded-md hover:bg-gray-50">Top</button>
<button data-sort-by="new" class="sort-btn active px-3 py-1 text-sm font-action bg-primary text-white rounded-md hover:bg-primary-dark transition-colors duration-150 ease-in-out">New</button>
<button data-sort-by="top" class="sort-btn px-3 py-1 text-sm font-action bg-primary text-white rounded-md hover:bg-primary-dark transition-colors duration-150 ease-in-out">Top</button>
</div>
</div>
</div>
@@ -150,11 +150,15 @@ document.addEventListener('DOMContentLoaded', () => {
}
});
sortButtons.forEach(btn => {
btn.classList.toggle('active', btn.dataset.sortBy === currentSort);
if (btn.dataset.sortBy === currentSort) {
btn.classList.add('bg-blue-200', 'border-blue-400'); // Example active style
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-blue-200', 'border-blue-400');
btn.classList.remove('bg-primary-dark');
btn.classList.add('bg-primary');
}
});
}