Files
canina/frontend/admin-panel/src/components/ui/ThSort.tsx
T
devops ddbf1ca026
Deploy Canina / deploy (push) Successful in 4m1s
E2E Playwright Tests / Run Full E2E & Security Suites (push) Failing after 7s
test: comprehensive test suites and quality gates pass across backend, storefront and admin
- 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.
2026-10-13 16:01:00 +00:00

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>
);
}