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

fixed window callers

This commit is contained in:
Fedor Katurov 2022-01-07 19:16:42 +07:00
parent ba2e610e01
commit 224c27b6f4
6 changed files with 55 additions and 26 deletions

View file

@ -1,10 +1,11 @@
import React, { FC, useCallback } from "react";
import { SortEnd } from "react-sortable-hoc";
import styles from "./styles.module.scss";
import { IFile } from "~/redux/types";
import { moveArrItem } from "~/utils/fn";
import { SortableImageGrid } from "~/components/editors/SortableImageGrid";
import { UploadStatus } from "~/store/uploader/UploaderStore";
import React, { FC, useCallback } from 'react';
import { SortEnd } from 'react-sortable-hoc';
import styles from './styles.module.scss';
import { IFile } from '~/redux/types';
import { moveArrItem } from '~/utils/fn';
import { SortableImageGrid } from '~/components/editors/SortableImageGrid';
import { UploadStatus } from '~/store/uploader/UploaderStore';
import { useWindowSize } from '~/hooks/dom/useWindowSize';
interface IProps {
files: IFile[];
@ -13,6 +14,8 @@ interface IProps {
}
const ImageGrid: FC<IProps> = ({ files, setFiles, locked }) => {
const { innerWidth } = useWindowSize();
const onMove = useCallback(
({ oldIndex, newIndex }: SortEnd) => {
setFiles(
@ -40,7 +43,7 @@ const ImageGrid: FC<IProps> = ({ files, setFiles, locked }) => {
axis="xy"
items={files}
locked={locked}
pressDelay={window.innerWidth < 768 ? 200 : 0}
pressDelay={innerWidth < 768 ? 200 : 0}
helperClass={styles.helper}
/>
);