37 lines
765 B
TypeScript
37 lines
765 B
TypeScript
interface SortIconProps {
|
|
column: string;
|
|
sort: string | null;
|
|
order: string;
|
|
}
|
|
|
|
export default function SortIcon({ column, sort, order }: SortIconProps) {
|
|
if (sort !== column) {
|
|
return (
|
|
<svg
|
|
width="12"
|
|
height="12"
|
|
viewBox="0 0 24 24"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
strokeWidth="2"
|
|
style={{ opacity: 0.3, marginLeft: 4 }}
|
|
>
|
|
<path d="M7 15l5 5 5-5M7 9l5-5 5 5" />
|
|
</svg>
|
|
);
|
|
}
|
|
return (
|
|
<svg
|
|
width="12"
|
|
height="12"
|
|
viewBox="0 0 24 24"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
strokeWidth="2"
|
|
style={{ marginLeft: 4 }}
|
|
>
|
|
{order === "asc" ? <path d="M7 15l5 5 5-5" /> : <path d="M7 9l5-5 5 5" />}
|
|
</svg>
|
|
);
|
|
}
|