mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-24 20:36:40 +07:00
removed PhotoSwipeStore
This commit is contained in:
parent
224c27b6f4
commit
82308d2a91
15 changed files with 90 additions and 84 deletions
|
@ -1,18 +1,15 @@
|
|||
import { useCallback } from 'react';
|
||||
import { IFile } from '~/redux/types';
|
||||
import { usePhotoSwipeStore } from '~/store/photoSwipe/usePhotoSwipeStore';
|
||||
import { useShowModal } from '~/hooks/modal/useShowModal';
|
||||
import { Dialog } from '~/constants/modal';
|
||||
|
||||
export const useImageModal = () => {
|
||||
const { setData } = usePhotoSwipeStore();
|
||||
const showModal = useShowModal(Dialog.Photoswipe);
|
||||
|
||||
return useCallback(
|
||||
(images: IFile[], index: number) => {
|
||||
setData(images, index);
|
||||
showModal();
|
||||
showModal({ items: images, index });
|
||||
},
|
||||
[setData, showModal]
|
||||
[showModal]
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue