Skip to content

Commit

Permalink
feat: arrows for sorting buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
0x4007 committed Jan 23, 2024
1 parent 719afd0 commit 7be70f5
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/home/sorting/sorting-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ export class SortingManager {
buttons.appendChild(input);
buttons.appendChild(label);

input.addEventListener("click", () => {
this._handleSortingClick(input, option);
});
input.addEventListener("click", () => this._handleSortingClick(input, option));
});

return buttons;
Expand Down Expand Up @@ -70,6 +68,13 @@ export class SortingManager {
input.setAttribute("data-ordering", ordering);
this._lastChecked = input.checked ? input : null;
this._filterTextBox.value = "";
input.parentElement?.childNodes.forEach((node) => {
if (node instanceof HTMLInputElement) {
node.setAttribute("data-ordering", "");
}
});

input.setAttribute("data-ordering", ordering);
fetchAndDisplayPreviews(option as Sorting, { ordering }).catch((error) => console.error(error));
}
}
8 changes: 8 additions & 0 deletions static/style/inverted-style.css
Original file line number Diff line number Diff line change
Expand Up @@ -591,4 +591,12 @@
p.organization-name::after {
content: "/";
}
input[type="radio"][data-ordering="reverse"] + label::after {
margin-left: 6px;
content: "▲";
}
input[type="radio"][data-ordering="normal"] + label::after {
margin-left: 6px;
content: "▼";
}
}
8 changes: 8 additions & 0 deletions static/style/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -591,4 +591,12 @@
p.organization-name::after {
content: "/";
}
input[type="radio"][data-ordering="reverse"] + label::after {
margin-left: 6px;
content: "▲";
}
input[type="radio"][data-ordering="normal"] + label::after {
margin-left: 6px;
content: "▼";
}
}

0 comments on commit 7be70f5

Please sign in to comment.