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

dropping items

This commit is contained in:
Fedor Katurov 2019-10-16 12:51:38 +07:00
parent 770f3cb2aa
commit a957281d01

View file

@ -17,11 +17,11 @@ interface IProps {
locked: IUploadStatus[];
}
const SortableItem = SortableElement(({ children }) => (
const SortableImageGridItem = SortableElement(({ children }) => (
<div className={styles.item}>{children}</div>
));
const SortableList = SortableContainer(
const SortableImageGrid = SortableContainer(
({
items,
locked,
@ -35,15 +35,15 @@ const SortableList = SortableContainer(
{items
.filter(file => file && file.id)
.map((file, index) => (
<SortableItem key={file.id} index={index} collection={0}>
<SortableImageGridItem key={file.id} index={index} collection={0}>
<ImageUpload id={file.id} thumb={getURL(file)} onDrop={onDrop} />
</SortableItem>
</SortableImageGridItem>
))}
{locked.map((item, index) => (
<SortableItem key={item.temp_id} index={index} collection={1} disabled>
<SortableImageGridItem key={item.temp_id} index={index} collection={1} disabled>
<ImageUpload thumb={item.preview} progress={item.progress} is_uploading />
</SortableItem>
</SortableImageGridItem>
))}
</div>
)
@ -67,7 +67,7 @@ const ImageGrid: FC<IProps> = ({ data, setData, locked }) => {
);
return (
<SortableList
<SortableImageGrid
onDrop={onDrop}
onSortEnd={onMove}
axis="xy"