2019-12-02 13:58:56 +01:00
|
|
|
import React, { FC } from "react";
|
2019-12-05 08:56:40 +01:00
|
|
|
import { ColumnProps } from "./types";
|
2019-12-05 13:16:54 +01:00
|
|
|
import comparators from "../comparators";
|
2019-11-29 15:57:36 +01:00
|
|
|
|
|
|
|
|
type Props = ColumnProps & {
|
|
|
|
|
dataKey: string;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const TextColumn: FC<Props> = ({ row, dataKey }) => {
|
|
|
|
|
return row[dataKey];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
TextColumn.defaultProps = {
|
2019-12-03 16:04:11 +01:00
|
|
|
createComparator: (props: Props) => {
|
2019-12-05 13:16:54 +01:00
|
|
|
return comparators.byKey(props.dataKey);
|
2019-11-29 17:13:39 +01:00
|
|
|
},
|
2019-12-02 13:58:56 +01:00
|
|
|
ascendingIcon: "sort-alpha-down-alt",
|
|
|
|
|
descendingIcon: "sort-alpha-down"
|
2019-11-29 15:57:36 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default TextColumn;
|