From 41a1fff53b5238634c6665c09d36459fc5c1ab20 Mon Sep 17 00:00:00 2001 From: Tilman Date: Sat, 11 Oct 2025 00:45:43 +0200 Subject: [PATCH] Use sort SVGs --- components/files/ListFiles.tsx | 37 +++++++++++++++++++++++++++------- static/images/sort-none.svg | 14 +++++++++++++ static/images/sort-up.svg | 10 +++++++++ 3 files changed, 54 insertions(+), 7 deletions(-) create mode 100644 static/images/sort-none.svg create mode 100644 static/images/sort-up.svg diff --git a/components/files/ListFiles.tsx b/components/files/ListFiles.tsx index e057e4f..7a960db 100644 --- a/components/files/ListFiles.tsx +++ b/components/files/ListFiles.tsx @@ -63,9 +63,33 @@ export default function ListFiles( const dateFormat = new Intl.DateTimeFormat('en-GB', dateFormatOptions); - function getSortIcon(column: SortColumn): string | null { - if (sortBy !== column) return '↕'; // neutral sort icon - return sortOrder === 'asc' ? '↑' : '↓'; + function renderSortIcon(column: SortColumn): ComponentChildren { + const isActive = sortBy === column; + + if (isActive) { + // Show active sort icon with rotation + const rotation = sortOrder === 'asc' ? '' : 'rotate-180'; + return ( + {`Sort + ); + } else { + // Show neutral sort icon only on hover + return ( + Sort + ); + } } function renderSortableHeader( @@ -74,7 +98,6 @@ export default function ListFiles( className?: string, ): ComponentChildren { const isActive = sortBy === column; - const iconClass = isActive ? 'text-blue-400' : 'text-slate-400'; if (!onClickSort) { return {label}; @@ -83,15 +106,15 @@ export default function ListFiles( return ( diff --git a/static/images/sort-none.svg b/static/images/sort-none.svg new file mode 100644 index 0000000..fac4d4a --- /dev/null +++ b/static/images/sort-none.svg @@ -0,0 +1,14 @@ + + + diff --git a/static/images/sort-up.svg b/static/images/sort-up.svg new file mode 100644 index 0000000..4acc6dc --- /dev/null +++ b/static/images/sort-up.svg @@ -0,0 +1,10 @@ + + +