From 3bfcc82af3d3f0e8d537aa7caaf3386b9f9025d4 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Sun, 10 Jan 2021 16:49:21 +0100 Subject: [PATCH] core: simplify table icon type declarations --- packages/core/src/components/Table/Table.tsx | 67 ++++++-------------- 1 file changed, 19 insertions(+), 48 deletions(-) diff --git a/packages/core/src/components/Table/Table.tsx b/packages/core/src/components/Table/Table.tsx index 852f4a1547..dbb2964845 100644 --- a/packages/core/src/components/Table/Table.tsx +++ b/packages/core/src/components/Table/Table.tsx @@ -40,6 +40,7 @@ import ViewColumn from '@material-ui/icons/ViewColumn'; import { isEqual, transform } from 'lodash'; import MTable, { Column, + Icons, MaterialTableProps, MTableHeader, MTableToolbar, @@ -56,58 +57,28 @@ import { CheckboxTreeProps } from '../CheckboxTree/CheckboxTree'; import { SelectProps } from '../Select/Select'; import { Filter, Filters, SelectedFilters, Without } from './Filters'; -const tableIcons = { - Add: forwardRef((props, ref: React.Ref) => ( - - )), - Check: forwardRef((props, ref: React.Ref) => ( - - )), - Clear: forwardRef((props, ref: React.Ref) => ( - - )), - Delete: forwardRef((props, ref: React.Ref) => ( - - )), - DetailPanel: forwardRef((props, ref: React.Ref) => ( +const tableIcons: Icons = { + Add: forwardRef((props, ref) => ), + Check: forwardRef((props, ref) => ), + Clear: forwardRef((props, ref) => ), + Delete: forwardRef((props, ref) => ), + DetailPanel: forwardRef((props, ref) => ( )), - Edit: forwardRef((props, ref: React.Ref) => ( - - )), - Export: forwardRef((props, ref: React.Ref) => ( - - )), - Filter: forwardRef((props, ref: React.Ref) => ( - - )), - FirstPage: forwardRef((props, ref: React.Ref) => ( - - )), - LastPage: forwardRef((props, ref: React.Ref) => ( - - )), - NextPage: forwardRef((props, ref: React.Ref) => ( - - )), - PreviousPage: forwardRef((props, ref: React.Ref) => ( + Edit: forwardRef((props, ref) => ), + Export: forwardRef((props, ref) => ), + Filter: forwardRef((props, ref) => ), + FirstPage: forwardRef((props, ref) => ), + LastPage: forwardRef((props, ref) => ), + NextPage: forwardRef((props, ref) => ), + PreviousPage: forwardRef((props, ref) => ( )), - ResetSearch: forwardRef((props, ref: React.Ref) => ( - - )), - Search: forwardRef((props, ref: React.Ref) => ( - - )), - SortArrow: forwardRef((props, ref: React.Ref) => ( - - )), - ThirdStateCheck: forwardRef((props, ref: React.Ref) => ( - - )), - ViewColumn: forwardRef((props, ref: React.Ref) => ( - - )), + ResetSearch: forwardRef((props, ref) => ), + Search: forwardRef((props, ref) => ), + SortArrow: forwardRef((props, ref) => ), + ThirdStateCheck: forwardRef((props, ref) => ), + ViewColumn: forwardRef((props, ref) => ), }; // TODO: Material table might already have such a function internally that we can use?