Skip to content

Commit

Permalink
feat: ContentModal 에 isCloseOnBackground props 추가 (#533)
Browse files Browse the repository at this point in the history
- 추후에 배경화면 클릭과 esc를 통한 닫기 기능을 막는 작업을 분리해서 할 수 있도록 해야할 것 같아요.
  • Loading branch information
BadaHertz52 authored Aug 23, 2024
1 parent e10d644 commit 0ae1630
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions frontend/src/components/common/modals/ContentModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,18 @@ import * as S from './styles';
interface ContentModalProps {
title?: string;
handleClose: () => void;
isClosableOnBackground?: boolean;
}

const ContentModal = ({ title, handleClose, children }: EssentialPropsWithChildren<ContentModalProps>) => {
const ContentModal = ({
title,
handleClose,
children,
isClosableOnBackground = true,
}: EssentialPropsWithChildren<ContentModalProps>) => {
return (
<ModalPortal>
<ModalBackground closeModal={handleClose}>
<ModalBackground closeModal={isClosableOnBackground ? handleClose : null}>
<S.ContentModalContainer>
<S.ContentModalHeader>
<S.Title>{title}</S.Title>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as S from './styles';
interface ModalBackgroundProps {
closeModal: (() => void) | null;
}

// TODO: 배경, ESC를 통한 모달 닫히는 기능을 불리해야함
const ModalBackground: React.FC<PropsWithChildren<ModalBackgroundProps>> = ({ children, closeModal }) => {
const modalBackgroundRef = useRef<HTMLDivElement>(null);
useModalClose({ closeModal, modalBackgroundRef });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const PasswordModal = ({ closeModal, reviewRequestCode }: PasswordModalProps) =>
};

return (
<ContentModal title={REVIEW_PASSWORD_INPUT_MESSAGE} handleClose={closeModal}>
<ContentModal title={REVIEW_PASSWORD_INPUT_MESSAGE} handleClose={closeModal} isClosableOnBackground={false}>
<S.PasswordModal>
<S.InputContainer>
<S.PasswordInputContainer>
Expand Down

0 comments on commit 0ae1630

Please sign in to comment.