From 0f3fee41416e7ee674751d94c7ea79f5f6e9a4ab Mon Sep 17 00:00:00 2001 From: Jeongmin Woo Date: Mon, 10 Oct 2022 19:43:25 +0900 Subject: [PATCH] style: change code style Refs: https://github.com/woowacourse/service-apply/pull/649#discussion_r990599132 --- .../components/@common/ModalPortal/ModalPortal.tsx | 14 +++++++------- .../ApplicationPreviewModal.tsx | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/frontend/src/components/@common/ModalPortal/ModalPortal.tsx b/frontend/src/components/@common/ModalPortal/ModalPortal.tsx index 4b0f96ae1..1331ff195 100644 --- a/frontend/src/components/@common/ModalPortal/ModalPortal.tsx +++ b/frontend/src/components/@common/ModalPortal/ModalPortal.tsx @@ -12,6 +12,12 @@ const ModalPortal = ({ children, closeModal }: ModalPortalProps) => { const ref = useRef(null); const [mounted, setMounted] = useState(false); + const handleKeyDown: React.KeyboardEventHandler = (e) => { + if (e.key === "Escape") { + closeModal(); + } + }; + useEffect(() => { setMounted(true); @@ -28,14 +34,8 @@ const ModalPortal = ({ children, closeModal }: ModalPortalProps) => { if (ref.current && mounted) { return createPortal( -
{ - if (e.key === "Escape") closeModal(); - }} - > +
- {children}
, ref.current diff --git a/frontend/src/components/ApplicationPreviewModal/ApplicationPreviewModal.tsx b/frontend/src/components/ApplicationPreviewModal/ApplicationPreviewModal.tsx index f90340b27..39b6afd7e 100644 --- a/frontend/src/components/ApplicationPreviewModal/ApplicationPreviewModal.tsx +++ b/frontend/src/components/ApplicationPreviewModal/ApplicationPreviewModal.tsx @@ -1,4 +1,4 @@ -import { ChangeEvent, useState } from "react"; +import { useState } from "react"; import useModalContext from "../../hooks/useModalContext"; import Button, { BUTTON_VARIANT } from "../@common/Button/Button"; import styles from "./ApplicationPreviewModal.module.css";