- Backend (NestJS): 82 suites, 641 tests passing; 0 ESLint errors; 0 tsc errors. Hardened SSL cert/key matching, SSRF IP pinning, and eBank validation. - Admin Panel (Vite/React): 48 suites, 300 tests passing; 0 ESLint errors; 0 tsc errors. Full coverage across all pages and settings. - Storefront (Next.js): 62 suites, 368 tests passing; 0 ESLint errors; 0 tsc errors. - Fixed unmount lifecycle guards, promise error handling, and component edge cases.
52 lines
1.4 KiB
TypeScript
52 lines
1.4 KiB
TypeScript
import { ArrowDown,ArrowUp,ArrowUpDown } from 'lucide-react';
|
|
import React from 'react';
|
|
|
|
export interface ThSortProps {
|
|
column: string;
|
|
label: React.ReactNode;
|
|
currentSortBy: string;
|
|
currentSortOrder: 'asc' | 'desc';
|
|
onSort: (column: string) => void;
|
|
className?: string;
|
|
align?: 'right' | 'center' | 'left';
|
|
}
|
|
|
|
export default function ThSort({
|
|
column,
|
|
label,
|
|
currentSortBy,
|
|
currentSortOrder,
|
|
onSort,
|
|
className = '',
|
|
align = 'right',
|
|
}: ThSortProps) {
|
|
const isSorted = currentSortBy === column;
|
|
|
|
const alignClasses =
|
|
align === 'left'
|
|
? 'justify-start text-left'
|
|
: align === 'center'
|
|
? 'justify-center text-center'
|
|
: 'justify-start text-right';
|
|
|
|
return (
|
|
<th
|
|
onClick={() => onSort(column)}
|
|
className={`p-4 font-black text-xs text-gray-600 hover:text-purple-700 cursor-pointer select-none transition-colors group ${className}`}
|
|
>
|
|
<div className={`flex items-center gap-1.5 ${alignClasses}`}>
|
|
<span className="group-hover:text-purple-600 transition-colors">{label}</span>
|
|
{isSorted ? (
|
|
currentSortOrder === 'asc' ? (
|
|
<ArrowUp className="w-3.5 h-3.5 text-purple-600 shrink-0" />
|
|
) : (
|
|
<ArrowDown className="w-3.5 h-3.5 text-purple-600 shrink-0" />
|
|
)
|
|
) : (
|
|
<ArrowUpDown className="w-3.5 h-3.5 text-gray-300 group-hover:text-gray-400 shrink-0 transition-colors" />
|
|
)}
|
|
</div>
|
|
</th>
|
|
);
|
|
}
|