diff --git a/front/src/pages/PlugIn/modal/MPage1.tsx b/front/src/pages/PlugIn/modal/MPage1.tsx index 25c426d..9438298 100644 --- a/front/src/pages/PlugIn/modal/MPage1.tsx +++ b/front/src/pages/PlugIn/modal/MPage1.tsx @@ -3,7 +3,7 @@ import discord from "../../../assets/images/discord_screenshot.png"; const MPage1 = () => { return (
- 디스코드 화면 + 디스코드 화면

1. 디스코드 데스크톱 애플리케이션을 실행해주세요.

diff --git a/front/src/pages/PlugIn/modal/Modal.tsx b/front/src/pages/PlugIn/modal/Modal.tsx index 35118ba..a44d44d 100644 --- a/front/src/pages/PlugIn/modal/Modal.tsx +++ b/front/src/pages/PlugIn/modal/Modal.tsx @@ -1,4 +1,4 @@ -import { useEffect, useState } from "react"; +import { useEffect, useState, useRef } from "react"; import { ModalPortal } from "../../../utils/helpers/ModalPortal"; import { GrClose, GrNext, GrPrevious } from "react-icons/gr"; import MPage1 from "./MPage1"; @@ -9,9 +9,12 @@ import { ModalProps } from "../../../types/ModalProps"; const Modal = ({ onOpenModal }: ModalProps) => { useEffect(() => { document.body.style.overflow = "hidden"; + document.addEventListener("mousedown", outsideClickHandler); return () => { document.body.style.overflow = "auto"; + document.removeEventListener("mousedown", outsideClickHandler); }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const [currentPage, setCurrentPage] = useState(1); @@ -28,20 +31,21 @@ const Modal = ({ onOpenModal }: ModalProps) => { } }; + const modalRef = useRef(null); + + const outsideClickHandler = (e: MouseEvent) => { + if (modalRef.current && !modalRef.current.contains(e.target as Node)) { + onOpenModal(); + } + }; + return (
-
-
-

- 디스코드 연결 가이드 -

- -
+
-
+
{translate ? ( ) : ( -
+

@@ -88,7 +88,7 @@ const Translate = () => {

{translate ? ( -
+

{text}

@@ -125,7 +125,7 @@ const Translate = () => {
) : (
-
+

번역을 시작하려면
아래 버튼을 눌러주세요.
diff --git a/front/src/pages/TranslatePage/config/ConfigModal.tsx b/front/src/pages/TranslatePage/config/ConfigModal.tsx index 48573df..76119ac 100644 --- a/front/src/pages/TranslatePage/config/ConfigModal.tsx +++ b/front/src/pages/TranslatePage/config/ConfigModal.tsx @@ -156,7 +156,7 @@ const ConfigModal = ({ onOpenModal }: ModalProps) => { ref={modalRef} className="container w-[42rem] h-[28rem] flex flex-col items-center justify-center bg-white rounded-3xl shadow-lg" > - +

) : (
{

설정할 플랫폼을 선택해주세요

-
+
{
{selectedItem!.name === "Discord" ? ( loading ? ( -
-
+
+

loading... -

+

) : ( -
+
{ +import { useEffect } from "react"; + +interface ConfigSuccessProps { + onModalAlert: () => void; +} + +export const ConfigSuccess = ({ onModalAlert }: ConfigSuccessProps) => { + useEffect(() => { + const timer = setTimeout(() => { + onModalAlert(); + }, 1500); + return () => clearTimeout(timer); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + return (

🥳