dnazarenkoo 8f1451e154
feat: add the ability to drag columns (#3100)
* feat: add the ability to drag columns

* feat: add the ability to drag columns in the logs explorer

* feat: update drag logic

* fix: resolve comments

* feat: resolve comment regarding error handling

---------

Co-authored-by: Vishal Sharma <makeavish786@gmail.com>
Co-authored-by: Palash Gupta <palashgdev@gmail.com>
2023-07-18 17:18:34 +05:30

25 lines
736 B
TypeScript

import { dragColumnParams } from 'hooks/useDragColumns/configs';
import ReactDragListView from 'react-drag-listview';
import { TableComponents } from 'react-virtuoso';
import { TableStyled } from './styles';
interface LogsCustomTableProps {
handleDragEnd: (fromIndex: number, toIndex: number) => void;
}
export const LogsCustomTable = ({
handleDragEnd,
}: LogsCustomTableProps): TableComponents['Table'] =>
function CustomTable({ style, children }): JSX.Element {
return (
<ReactDragListView.DragColumn
// eslint-disable-next-line react/jsx-props-no-spreading
{...dragColumnParams}
onDragEnd={handleDragEnd}
>
<TableStyled style={style}>{children}</TableStyled>
</ReactDragListView.DragColumn>
);
};