1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-28 14:16:41 +07:00

added SortableAudioGrid

This commit is contained in:
Fedor Katurov 2022-06-30 15:58:46 +07:00
parent 586ebb7480
commit 47a6e02c21
14 changed files with 175 additions and 131 deletions

View file

@ -1,27 +1,16 @@
import React, { createElement, FC, useCallback, useMemo, useState } from 'react';
import React, { createElement, FC, useMemo } from "react";
import {
closestCenter,
DndContext,
DragOverlay,
DragStartEvent,
MouseSensor,
TouchSensor,
useSensor,
useSensors,
} from '@dnd-kit/core';
import { DragEndEvent } from '@dnd-kit/core/dist/types';
import { rectSortingStrategy, SortableContext } from '@dnd-kit/sortable';
import classNames from 'classnames';
import { closestCenter, DndContext, DragOverlay } from "@dnd-kit/core";
import { rectSortingStrategy, SortableContext } from "@dnd-kit/sortable";
import classNames from "classnames";
import { DragOverlayItem } from '~/components/sortable/DragOverlayItem';
import { useSortableActions } from '~/hooks/sortable';
import { moveArrItem } from '~/utils/fn';
import { DivProps } from '~/utils/types';
import { DragOverlayItem } from "~/components/sortable/DragOverlayItem";
import { useSortableActions } from "~/hooks/sortable";
import { DivProps } from "~/utils/types";
import { SortableImageGridItem } from '../SortableGridItem';
import { SortableItem } from "../SortableItem";
import styles from './styles.module.scss';
import styles from "./styles.module.scss";
interface SortableGridProps<T extends {}, R extends {}> {
items: T[];
@ -70,7 +59,7 @@ const SortableGrid = <T, R>({
<SortableContext items={ids} strategy={rectSortingStrategy}>
<div className={classNames(styles.grid, className)} style={gridStyle}>
{items.map(item => (
<SortableImageGridItem
<SortableItem
key={getID(item)}
id={getID(item)}
className={
@ -78,7 +67,7 @@ const SortableGrid = <T, R>({
}
>
{createElement(renderItem, { item })}
</SortableImageGridItem>
</SortableItem>
))}
{locked.map(item =>