@@ -47,6 +47,91 @@ export const Table: React.FC<TableProps> = ({
4747 renderAfterRow,
4848 trOnClick,
4949} ) => {
50+
51+ // const [tableHeight, setTableHeight] = useState("auto");
52+ // const [activeIndex, setActiveIndex] = useState(null);
53+ // const tableElement = useRef(null);
54+ // const createHeaders = (headers: any) => {
55+ // return headerCols?.map((item: any) => ({
56+ // text: item,
57+ // ref: tableElement
58+ // }));
59+ // };
60+
61+ // const columns = createHeaders(headerCols?.length);
62+
63+ // const minCellWidth = 120
64+
65+ // useEffect(() => {
66+ // // @ts -ignore
67+ // // console.log(tableElement && tableElement.current.offsetHeight);
68+ // setTableHeight(tableElement?.current?.offsetHeight);
69+ // }, []);
70+
71+ // const mouseDown = (index: any) => {
72+ // setActiveIndex(index);
73+ // };
74+
75+
76+ // const mouseMove = useCallback(
77+ // (e) => {
78+ // const gridColumns = columns.map((col: any, i: any) => {
79+ // if (i === activeIndex) {
80+ // const width = e.clientX - col.ref.current.offsetLeft;
81+
82+ // if (width >= minCellWidth) {
83+ // return `${width}px`;
84+ // }
85+ // }
86+ // return `${col.ref.current.offsetWidth}px`;
87+ // });
88+
89+ // // @ts -ignore
90+ // tableElement.current.style.gridTemplateColumns = `${gridColumns.join(
91+ // " "
92+ // )}`;
93+ // },
94+ // [activeIndex, columns, minCellWidth]
95+ // );
96+
97+ // const removeListeners = useCallback(() => {
98+ // window.removeEventListener("mousemove", mouseMove);
99+ // window.removeEventListener("mouseup", removeListeners);
100+ // }, [mouseMove]);
101+
102+ // const mouseUp = useCallback(() => {
103+ // setActiveIndex(null);
104+ // removeListeners();
105+ // }, [setActiveIndex, removeListeners]);
106+
107+ // useEffect(() => {
108+ // if (activeIndex !== null) {
109+ // window.addEventListener("mousemove", mouseMove);
110+ // window.addEventListener("mouseup", mouseUp);
111+ // }
112+
113+ // return () => {
114+ // removeListeners();
115+ // };
116+ // }, [activeIndex, mouseMove, mouseUp, removeListeners]);
117+
118+ // // Demo only
119+ // const resetTableCells = () => {
120+ // // @ts -ignore
121+ // tableElement.current.style.gridTemplateColumns = "";
122+ // };
123+
124+
125+
126+
127+
128+
129+
130+
131+
132+
133+
134+
50135 const { pageIndex, setPageIndex } = usePaginationAsQueryParam ( ) ;
51136
52137 const { itemsForPage, pages, totalOfPages } = getPaginationData ( {
@@ -64,31 +149,28 @@ export const Table: React.FC<TableProps> = ({
64149 if ( loading ) {
65150 return < FullWidthSpinner color = "black" size = "md" /> ;
66151 }
67-
68-
152+
69153 return (
70154 < FlexBox . Column className = { styles . tableWrapper } fullWidth >
71155 < IfElse
72156 condition = { tableRows . length > 0 && ! loading }
73157 renderWhenTrue = { ( ) => (
74158 < >
75159 < table className = { styles . table } >
76- < thead style = { { backgroundColor : '#F4F4F4' } } >
160+ < thead >
77161 < tr className = { showHeader ? styles . tableHeaderRow : '' } >
78- { headerCols . map ( ( headerCol : HeaderCol , index : number ) => (
162+ { headerCols . map ( ( headerCol : HeaderCol , index : number , i ) => (
79163 < th
80- className = { styles . tableHeadingTh }
164+ className = { styles . tableHeadingTh }
81165 style = { {
82166 width : headerCol . width ,
83- color : '#000' ,
167+ color : '#424240' ,
168+ fontSize : '14px' ,
84169 fontWeight : 700 ,
85170 } }
86171 key = { index }
87172 >
88- < Box
89- paddingVertical = { showHeader ? 'sm' : null }
90- paddingLeft = "lg"
91- >
173+ < Box style = { { backgroundColor : 'rgba(217, 217, 217, 0.2)' } } paddingVertical = { showHeader ? 'sm' : null } paddingLeft = "lg" >
92174 { headerCol . render && headerCol . render ( ) }
93175 </ Box >
94176 </ th >
@@ -111,6 +193,7 @@ export const Table: React.FC<TableProps> = ({
111193 styles . tableRow ,
112194 trOnClick && styles . clickableTableRow ,
113195 ) }
196+ style = { { backgroundColor : index % 2 !== 0 ? '#F5F3F9' : 'white' } }
114197 key = { index }
115198 >
116199 { headerCols . map ( ( headerCol : HeaderCol , index : number ) => (
@@ -119,7 +202,7 @@ export const Table: React.FC<TableProps> = ({
119202 style = { { width : headerCol . width } }
120203 key = { index }
121204 >
122- < Box paddingVertical = "md " paddingLeft = "lg" >
205+ < Box paddingVertical = "sm " paddingLeft = "lg" >
123206 < Truncate maxLines = { 1 } >
124207 { headerCol . renderRow ( headerRow ) }
125208 </ Truncate >
0 commit comments