1
0
Fork 0

Merge sort order into sort buttons

This commit is contained in:
Lim Chee Aun 2024-03-05 19:11:28 +08:00
parent 8a9f1a3c25
commit c0ad216227

View file

@ -1134,7 +1134,17 @@ function Catchup() {
'density', 'density',
// 'account', // 'account',
].map((key) => ( ].map((key) => (
<label class="filter-sort" key={key}> <label
class="filter-sort"
key={key}
onClick={(e) => {
if (sortBy === key) {
e.preventDefault();
e.stopPropagation();
setSortOrder(sortOrder === 'asc' ? 'desc' : 'asc');
}
}}
>
<input <input
type="radio" type="radio"
name="filter-sort-cat" name="filter-sort-cat"
@ -1148,7 +1158,6 @@ function Catchup() {
: 'asc'; : 'asc';
setSortOrder(order); setSortOrder(order);
}} }}
// disabled={key === 'account' && selectedAuthor}
/> />
{ {
{ {
@ -1159,10 +1168,11 @@ function Catchup() {
density: 'Density', density: 'Density',
}[key] }[key]
} }
{sortBy === key && (sortOrder === 'asc' ? ' ↑' : ' ↓')}
</label> </label>
))} ))}
</fieldset> </fieldset>
<fieldset class="radio-field-group"> {/* <fieldset class="radio-field-group">
{['asc', 'desc'].map((key) => ( {['asc', 'desc'].map((key) => (
<label class="filter-sort" key={key}> <label class="filter-sort" key={key}>
<input <input
@ -1176,7 +1186,7 @@ function Catchup() {
{key === 'asc' ? '↑' : '↓'} {key === 'asc' ? '↑' : '↓'}
</label> </label>
))} ))}
</fieldset> </fieldset> */}
<span class="filter-label">Group</span>{' '} <span class="filter-label">Group</span>{' '}
<fieldset class="radio-field-group"> <fieldset class="radio-field-group">
{[null, 'account'].map((key) => ( {[null, 'account'].map((key) => (