mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-09 06:55:47 +01:00
move comparators from scm-review-plugin to ui-components
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import React, { FC } from "react";
|
||||
import { ColumnProps } from "./types";
|
||||
import comparators from "../comparators";
|
||||
|
||||
type Props = ColumnProps & {
|
||||
dataKey: string;
|
||||
@@ -11,15 +12,7 @@ const TextColumn: FC<Props> = ({ row, dataKey }) => {
|
||||
|
||||
TextColumn.defaultProps = {
|
||||
createComparator: (props: Props) => {
|
||||
return (a: any, b: any) => {
|
||||
if (a[props.dataKey] < b[props.dataKey]) {
|
||||
return -1;
|
||||
} else if (a[props.dataKey] > b[props.dataKey]) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
return comparators.byKey(props.dataKey);
|
||||
},
|
||||
ascendingIcon: "sort-alpha-down-alt",
|
||||
descendingIcon: "sort-alpha-down"
|
||||
|
||||
Reference in New Issue
Block a user