From 2c40d92b66464ea5f3cf94fa01574feaa6481c20 Mon Sep 17 00:00:00 2001 From: "@u_limit_" Date: Wed, 20 Nov 2024 00:20:10 +0900 Subject: [PATCH 1/7] =?UTF-8?q?refactor(Modal):=20=EB=84=A4=EC=9D=B4?= =?UTF-8?q?=EB=B0=8D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 다른 모달과의 구분을 위해 Modal에서 CloseModal로 네이밍을 변경했습니다. --- .../{Modal/ModalTest.css => CloseModal/CloseModalTest.css} | 0 .../{Modal/ModalTest.jsx => CloseModal/CloseModalTest.jsx} | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename frontend/moim_front/src/components/{Modal/ModalTest.css => CloseModal/CloseModalTest.css} (100%) rename frontend/moim_front/src/components/{Modal/ModalTest.jsx => CloseModal/CloseModalTest.jsx} (96%) diff --git a/frontend/moim_front/src/components/Modal/ModalTest.css b/frontend/moim_front/src/components/CloseModal/CloseModalTest.css similarity index 100% rename from frontend/moim_front/src/components/Modal/ModalTest.css rename to frontend/moim_front/src/components/CloseModal/CloseModalTest.css diff --git a/frontend/moim_front/src/components/Modal/ModalTest.jsx b/frontend/moim_front/src/components/CloseModal/CloseModalTest.jsx similarity index 96% rename from frontend/moim_front/src/components/Modal/ModalTest.jsx rename to frontend/moim_front/src/components/CloseModal/CloseModalTest.jsx index 2a664707..2fa46e3f 100644 --- a/frontend/moim_front/src/components/Modal/ModalTest.jsx +++ b/frontend/moim_front/src/components/CloseModal/CloseModalTest.jsx @@ -1,4 +1,4 @@ -import "./ModalTest.css"; +import "./CloseModalTest.css"; export default function Modal({ isOpen, setIsOpen, message }) { // Add class to body when modal is active to remove scroll bar From 78dbbfa6d772425c0a9f647cde3bbeea0505c34f Mon Sep 17 00:00:00 2001 From: "@u_limit_" Date: Wed, 20 Nov 2024 01:08:12 +0900 Subject: [PATCH 2/7] =?UTF-8?q?refactor(LoginPage):=20Modal=20=EC=BB=B4?= =?UTF-8?q?=ED=8F=AC=EB=84=8C=ED=8A=B8=20=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modal을 컴포넌트화 했습니다. --- .../moim_front/src/components/Modal/index.jsx | 29 +++++++ .../src/components/Modal/modalTheme.js | 54 +++++++++++++ frontend/moim_front/src/pages/Login/index.jsx | 81 ++----------------- 3 files changed, 88 insertions(+), 76 deletions(-) create mode 100644 frontend/moim_front/src/components/Modal/index.jsx create mode 100644 frontend/moim_front/src/components/Modal/modalTheme.js diff --git a/frontend/moim_front/src/components/Modal/index.jsx b/frontend/moim_front/src/components/Modal/index.jsx new file mode 100644 index 00000000..43707198 --- /dev/null +++ b/frontend/moim_front/src/components/Modal/index.jsx @@ -0,0 +1,29 @@ +import { Modal } from "flowbite-react"; +import { HiOutlineExclamationCircle } from "react-icons/hi"; + +export default function AlertModal({show, onClose, message, theme}) { + return( + <> + + + +
+ +

+ {message} +

+
+ +
+
+
+
+ + ) +} + diff --git a/frontend/moim_front/src/components/Modal/modalTheme.js b/frontend/moim_front/src/components/Modal/modalTheme.js new file mode 100644 index 00000000..262b9905 --- /dev/null +++ b/frontend/moim_front/src/components/Modal/modalTheme.js @@ -0,0 +1,54 @@ +const modalTheme = { + "root": { + "base": "fixed inset-x-0 top-0 z-50 h-screen overflow-y-auto overflow-x-hidden md:inset-0 md:h-full", + "show": { + "on": "flex bg-gray-900 bg-opacity-50 dark:bg-opacity-80", + "off": "hidden" + }, + "sizes": { + "sm": "max-w-sm", + "md": "max-w-md", + "lg": "max-w-lg", + "xl": "max-w-xl", + "2xl": "max-w-2xl", + "3xl": "max-w-3xl", + "4xl": "max-w-4xl", + "5xl": "max-w-5xl", + "6xl": "max-w-6xl", + "7xl": "max-w-7xl" + }, + "positions": { + "top-left": "items-start justify-start", + "top-center": "items-start justify-center", + "top-right": "items-start justify-end", + "center-left": "items-center justify-start", + "center": "items-center justify-center", + "center-right": "items-center justify-end", + "bottom-right": "items-end justify-end", + "bottom-center": "items-end justify-center", + "bottom-left": "items-end justify-start" + } + }, + "content": { + "base": "relative h-full w-full p-4 md:h-auto", + "inner": "relative flex max-h-[90dvh] flex-col rounded-xl bg-white shadow dark:bg-gray-700" + }, + "body": { + "base": "flex-1 overflow-auto p-6", + "popup": "pt-0" + }, + "header": { + "base": "flex items-start justify-between rounded-t border-b mt-0.5 p-5 dark:border-gray-600", + "popup": "border-b-0 p-2", + "title": "pt-0.5 text-xl font-Pretendard_SemiBold text-gray-900 dark:text-white", + "close": { + "base": "ml-auto inline-flex items-center rounded-lg bg-transparent p-1.5 text-sm text-gray-400 hover:bg-gray-200 hover:text-gray-900 dark:hover:bg-gray-600 dark:hover:text-white", + "icon": "h-5 w-5" + } + }, + "footer": { + "base": "flex items-center space-x-2 rounded-b border-gray-200 p-6 dark:border-gray-600", + "popup": "border-t" + } +} +export default modalTheme; diff --git a/frontend/moim_front/src/pages/Login/index.jsx b/frontend/moim_front/src/pages/Login/index.jsx index 1ee76a92..be47ed7c 100644 --- a/frontend/moim_front/src/pages/Login/index.jsx +++ b/frontend/moim_front/src/pages/Login/index.jsx @@ -2,66 +2,14 @@ import { useState, useEffect } from "react"; // UI -import { Modal } from "flowbite-react"; -import { HiOutlineExclamationCircle } from "react-icons/hi"; + // Components import AuthRight from "../../components/AuthRight"; import AuthLeft from "../../components/AuthLeft"; +import AlertModal from "../../components/Modal/index.jsx"; +import ModalTheme from "../../components/Modal/modalTheme.js"; -const modalTheme = { - "root": { - "base": "fixed inset-x-0 top-0 z-50 h-screen overflow-y-auto overflow-x-hidden md:inset-0 md:h-full", - "show": { - "on": "flex bg-gray-900 bg-opacity-50 dark:bg-opacity-80", - "off": "hidden" - }, - "sizes": { - "sm": "max-w-sm", - "md": "max-w-md", - "lg": "max-w-lg", - "xl": "max-w-xl", - "2xl": "max-w-2xl", - "3xl": "max-w-3xl", - "4xl": "max-w-4xl", - "5xl": "max-w-5xl", - "6xl": "max-w-6xl", - "7xl": "max-w-7xl" - }, - "positions": { - "top-left": "items-start justify-start", - "top-center": "items-start justify-center", - "top-right": "items-start justify-end", - "center-left": "items-center justify-start", - "center": "items-center justify-center", - "center-right": "items-center justify-end", - "bottom-right": "items-end justify-end", - "bottom-center": "items-end justify-center", - "bottom-left": "items-end justify-start" - } - }, - "content": { - "base": "relative h-full w-full p-4 md:h-auto", - "inner": "relative flex max-h-[90dvh] flex-col rounded-xl bg-white shadow dark:bg-gray-700" - }, - "body": { - "base": "flex-1 overflow-auto p-6", - "popup": "pt-0" - }, - "header": { - "base": "flex items-start justify-between rounded-t border-b mt-0.5 p-5 dark:border-gray-600", - "popup": "border-b-0 p-2", - "title": "pt-0.5 text-xl font-Pretendard_SemiBold text-gray-900 dark:text-white", - "close": { - "base": "ml-auto inline-flex items-center rounded-lg bg-transparent p-1.5 text-sm text-gray-400 hover:bg-gray-200 hover:text-gray-900 dark:hover:bg-gray-600 dark:hover:text-white", - "icon": "h-5 w-5" - } - }, - "footer": { - "base": "flex items-center space-x-2 rounded-b border-gray-200 p-6 dark:border-gray-600", - "popup": "border-t" - } -} function LoginPage() { const [email, setEmail] = useState(""); @@ -86,26 +34,7 @@ function LoginPage() { return ( <> - setOpenAlertModal(false)} theme={modalTheme} popup> - - -
- -

- {message} -

-
- -
-
-
-
- + setOpenAlertModal(false)} message={"이메일 혹은 비밀번호를 다시 입력해주세요."} theme={ModalTheme}/>
Date: Wed, 20 Nov 2024 01:09:21 +0900 Subject: [PATCH 3/7] =?UTF-8?q?refactor:=20=EC=BD=94=EB=93=9C=20=EA=B0=80?= =?UTF-8?q?=EB=8F=85=EC=84=B1=20=ED=96=A5=EC=83=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 코드 가독성 향상을 위해 else문에 공백 추가 및 사용하지 않는 함수의 선언 및 사용하지 않는 변수의 삭제를 했습니다. --- frontend/moim_front/src/components/AuthLeft/index.jsx | 4 +++- frontend/moim_front/src/components/Button/index.jsx | 3 +-- frontend/moim_front/src/pages/Home/Home.jsx | 1 - 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/moim_front/src/components/AuthLeft/index.jsx b/frontend/moim_front/src/components/AuthLeft/index.jsx index a37024d8..da31b396 100644 --- a/frontend/moim_front/src/components/AuthLeft/index.jsx +++ b/frontend/moim_front/src/components/AuthLeft/index.jsx @@ -42,7 +42,9 @@ function AuthLeft({ if (errorCode === "404") { setOpenAlertModal(true); setMessage(error.response.data.message); - } else { + } + + else { setOpenAlertModal(true); setMessage(error.message); } diff --git a/frontend/moim_front/src/components/Button/index.jsx b/frontend/moim_front/src/components/Button/index.jsx index a8e3c1eb..a86636a0 100644 --- a/frontend/moim_front/src/components/Button/index.jsx +++ b/frontend/moim_front/src/components/Button/index.jsx @@ -1,8 +1,7 @@ import React from "react"; import { useNavigate } from "react-router"; -function Button({ name, textColor, bgColor, btnType, onClick }) { - const navigation = useNavigate(); +function Button({ name, textColor, bgColor, onClick }) { return (