feature: strongly type Table component
This commit is contained in:
@ -10,9 +10,9 @@ import TableHeader from './table-header/TableHeader';
|
|||||||
import { IconProp } from '@fortawesome/fontawesome-svg-core';
|
import { IconProp } from '@fortawesome/fontawesome-svg-core';
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
type OwnProps = {
|
type OwnProps<TData> = {
|
||||||
data: Array<any>;
|
data: Array<TData>;
|
||||||
columns: Array<ColumnDef<any, any>>;
|
columns: Array<ColumnDef<TData, any>>;
|
||||||
viewName: string;
|
viewName: string;
|
||||||
viewIcon?: IconProp;
|
viewIcon?: IconProp;
|
||||||
};
|
};
|
||||||
@ -60,7 +60,7 @@ const StyledTableWithHeader = styled.div`
|
|||||||
flex: 1;
|
flex: 1;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
function Table({ data, columns, viewName, viewIcon }: OwnProps) {
|
function Table<TData>({ data, columns, viewName, viewIcon }: OwnProps<TData>) {
|
||||||
const table = useReactTable({
|
const table = useReactTable({
|
||||||
data,
|
data,
|
||||||
columns,
|
columns,
|
||||||
|
|||||||
Reference in New Issue
Block a user