Skip to content

Commit

Permalink
style: change code style
Browse files Browse the repository at this point in the history
  • Loading branch information
greenblues1190 committed Oct 10, 2022
1 parent e9019cc commit 0f3fee4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions frontend/src/components/@common/ModalPortal/ModalPortal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ const ModalPortal = ({ children, closeModal }: ModalPortalProps) => {
const ref = useRef<Element | null>(null);
const [mounted, setMounted] = useState(false);

const handleKeyDown: React.KeyboardEventHandler<HTMLDivElement> = (e) => {
if (e.key === "Escape") {
closeModal();
}
};

useEffect(() => {
setMounted(true);

Expand All @@ -28,14 +34,8 @@ const ModalPortal = ({ children, closeModal }: ModalPortalProps) => {

if (ref.current && mounted) {
return createPortal(
<div
className={styles.box}
onKeyDown={(e) => {
if (e.key === "Escape") closeModal();
}}
>
<div className={styles.box} onKeyDown={handleKeyDown}>
<div className={styles["dimmer-box"]} onClick={closeModal} />

{children}
</div>,
ref.current
Expand Down
Original file line number Diff line number Diff line change
@@ -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";
Expand Down

0 comments on commit 0f3fee4

Please sign in to comment.