mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2025-01-11 18:57:31 +03:00
19 lines
669 B
TypeScript
19 lines
669 B
TypeScript
import { faCaretDown as caretDownIcon, faCaretUp as caretUpIcon } from '@fortawesome/free-solid-svg-icons';
|
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
import type { Order } from '../../../shlink-frontend-kit/src';
|
|
|
|
interface TableOrderIconProps<T> {
|
|
currentOrder: Order<T>;
|
|
field: T;
|
|
className?: string;
|
|
}
|
|
|
|
export function TableOrderIcon<T extends string = string>(
|
|
{ currentOrder, field, className = 'ms-1' }: TableOrderIconProps<T>,
|
|
) {
|
|
if (!currentOrder.dir || currentOrder.field !== field) {
|
|
return null;
|
|
}
|
|
|
|
return <FontAwesomeIcon icon={currentOrder.dir === 'ASC' ? caretUpIcon : caretDownIcon} className={className} />;
|
|
}
|