refactor table

This commit is contained in:
Eduard Heimbuch
2019-12-02 13:58:56 +01:00
parent dc169ecff9
commit 52057abef5
6 changed files with 92 additions and 41 deletions

View File

@@ -1,5 +1,5 @@
import React, {FC} from "react";
import {ColumnProps, SortTypes} from "./types";
import React, { FC } from "react";
import { ColumnProps } from "./types";
type Props = ColumnProps & {
dataKey: string;
@@ -10,7 +10,7 @@ const TextColumn: FC<Props> = ({ row, dataKey }) => {
};
TextColumn.defaultProps = {
createComparator: (props: Props) => {
createComparator: (props: Props, columnIndex) => {
return (a: any, b: any) => {
if (a[props.dataKey] < b[props.dataKey]) {
return -1;
@@ -21,7 +21,8 @@ TextColumn.defaultProps = {
}
};
},
sortType: SortTypes.Text
ascendingIcon: "sort-alpha-down-alt",
descendingIcon: "sort-alpha-down"
};
export default TextColumn;