1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 12:56:41 +07:00

made sortable grid component

This commit is contained in:
Fedor Katurov 2022-06-24 16:47:38 +07:00
parent 24ab0cb050
commit 3345939670
13 changed files with 243 additions and 170 deletions

View file

@ -1,44 +0,0 @@
import React, { FC } from 'react';
import { useSortable } from '@dnd-kit/sortable';
import { CSS } from '@dnd-kit/utilities';
import classNames from 'classnames';
import styles from './styles.module.scss';
interface SortableImageGridItemProps {
id: number;
disabled?: boolean;
className?: string;
}
const SortableImageGridItem: FC<SortableImageGridItemProps> = ({
children,
id,
disabled = false,
className,
}) => {
const { attributes, listeners, setNodeRef, transform, transition } = useSortable({
id,
disabled,
});
const style = {
transform: CSS.Transform.toString(transform),
transition,
};
return (
<div
ref={setNodeRef}
style={style}
{...attributes}
{...listeners}
className={classNames(styles.item, className)}
>
{children}
</div>
);
};
export { SortableImageGridItem };