Restore table component and website settings page

This commit is contained in:
Chris Walsh 2022-07-24 23:07:56 -07:00
parent 76bdb6b1d6
commit 765add71a9
No known key found for this signature in database
GPG key ID: 28EE0CCA6032019E
3 changed files with 9 additions and 80 deletions

View file

@ -1,4 +1,3 @@
import { DragDropContext, Draggable, Droppable } from 'react-beautiful-dnd';
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
@ -14,9 +13,6 @@ function Table({
rowKey,
showHeader = true,
children,
isDraggable = false,
dragId,
onDragEnd,
}) {
if (empty && rows.length === 0) {
return empty;
@ -40,37 +36,10 @@ function Table({
<div className={classNames(styles.body, bodyClassName)}>
{rows.length === 0 && <NoData />}
{!children &&
(isDraggable ? (
<DragDropContext onDragEnd={onDragEnd}>
<Droppable droppableId={dragId}>
{provided => (
<div {...provided.droppableProps} ref={provided.innerRef}>
{rows.map((row, index) => {
const id = rowKey ? rowKey(row) : index;
return (
<Draggable key={id} draggableId={`${dragId}-${id}`} index={index}>
{provided => (
<div
ref={provided.innerRef}
{...provided.draggableProps}
{...provided.dragHandleProps}
>
<TableRow columns={columns} row={row} />
</div>
)}
</Draggable>
);
})}
</div>
)}
</Droppable>
</DragDropContext>
) : (
rows.map((row, index) => {
const id = rowKey ? rowKey(row) : index;
return <TableRow key={id} columns={columns} row={row} />;
})
))}
rows.map((row, index) => {
const id = rowKey ? rowKey(row) : index;
return <TableRow key={id} columns={columns} row={row} />;
})}
{children}
</div>
</div>