1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-24 20:36:40 +07:00

fixed types

This commit is contained in:
Fedor Katurov 2022-06-30 17:34:44 +07:00
parent c173c96b57
commit 12ffd39082
2 changed files with 55 additions and 59 deletions

View file

@ -1,14 +1,14 @@
import React, { createElement, FC, memo } from 'react'; import React, { createElement, FC } from "react";
import { closestCenter, DndContext, DragOverlay } from '@dnd-kit/core'; import { closestCenter, DndContext, DragOverlay } from "@dnd-kit/core";
import { SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable'; import { SortableContext, verticalListSortingStrategy } from "@dnd-kit/sortable";
import classNames from 'classnames'; import classNames from "classnames";
import { DragOverlayItem } from '~/components/sortable/DragOverlayItem'; import { DragOverlayItem } from "~/components/sortable/DragOverlayItem";
import { SortableItem } from '~/components/sortable/SortableItem'; import { SortableItem } from "~/components/sortable/SortableItem";
import { useSortableActions } from '~/hooks/sortable'; import { useSortableActions } from "~/hooks/sortable";
import styles from './styles.module.scss'; import styles from "./styles.module.scss";
interface SortableListProps<T extends {}, R extends {}> { interface SortableListProps<T extends {}, R extends {}> {
items: T[]; items: T[];
@ -21,8 +21,7 @@ interface SortableListProps<T extends {}, R extends {}> {
className?: string; className?: string;
} }
const SortableList = memo( const SortableList = <T, R>({
<T, R>({
items, items,
locked, locked,
getID, getID,
@ -31,7 +30,7 @@ const SortableList = memo(
renderItem, renderItem,
renderLocked, renderLocked,
onSortEnd, onSortEnd,
}: SortableListProps<T, R>) => { }: SortableListProps<T, R>) => {
const { sensors, onDragEnd, onDragStart, draggingItem, ids } = useSortableActions( const { sensors, onDragEnd, onDragStart, draggingItem, ids } = useSortableActions(
items, items,
getID, getID,
@ -65,16 +64,13 @@ const SortableList = memo(
<DragOverlay> <DragOverlay>
{draggingItem ? ( {draggingItem ? (
<DragOverlayItem> <DragOverlayItem>{createElement(renderItem, { item: draggingItem })}</DragOverlayItem>
{createElement(renderItem, { item: draggingItem })}
</DragOverlayItem>
) : null} ) : null}
</DragOverlay> </DragOverlay>
</div> </div>
</SortableContext> </SortableContext>
</DndContext> </DndContext>
); );
} };
);
export { SortableList }; export { SortableList };

File diff suppressed because one or more lines are too long