Skip to content

Commit

Permalink
fix: 모달 노출시 스크롤 블락
Browse files Browse the repository at this point in the history
  • Loading branch information
miro-ring committed Feb 18, 2024
1 parent 5202bbb commit 3bd24e7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/components/Modal/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { useEffect } from 'react';

import DeleteFolderModal from '@domain/저장하는/components/DeleteFolderModal';
import { useModalStore } from '@stores/modal';

Expand All @@ -9,6 +11,16 @@ import MakeFolder from './modals/MakeFolder';
const Modal = () => {
const { type } = useModalStore();

useEffect(() => {
if (!type) return;

document.body.style.overflow = 'hidden';

return () => {
document.body.style.overflow = 'visible';
};
}, [type]);

if (type === 'deleteArticle') return <DeleteArticle />;

if (type === 'login') return <Login />;
Expand Down

0 comments on commit 3bd24e7

Please sign in to comment.