From d22de0acef62c0145ee8a478570413dee16c107a Mon Sep 17 00:00:00 2001 From: hwinkr Date: Wed, 26 Jul 2023 16:45:16 +0900 Subject: [PATCH] =?UTF-8?q?Delete:=20=ED=95=84=EC=9A=94=EC=97=86=EB=8A=94?= =?UTF-8?q?=20=ED=8F=B4=EB=8D=94,=20=ED=8C=8C=EC=9D=BC=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Modal/MajorModal/index.test.tsx | 36 -------- src/components/Modal/MajorModal/index.tsx | 36 -------- .../Modal/MapBoundsLimitModal/index.tsx | 28 ------ .../Modal/MapLevelLimitModal/index.tsx | 28 ------ .../Modal/SuggestionModal/SuggestionInput.tsx | 87 ------------------- .../SuggestionModal/SuggestionThxMessage.tsx | 20 ----- 6 files changed, 235 deletions(-) delete mode 100644 src/components/Modal/MajorModal/index.test.tsx delete mode 100644 src/components/Modal/MajorModal/index.tsx delete mode 100644 src/components/Modal/MapBoundsLimitModal/index.tsx delete mode 100644 src/components/Modal/MapLevelLimitModal/index.tsx delete mode 100644 src/components/Modal/SuggestionModal/SuggestionInput.tsx delete mode 100644 src/components/Modal/SuggestionModal/SuggestionThxMessage.tsx diff --git a/src/components/Modal/MajorModal/index.test.tsx b/src/components/Modal/MajorModal/index.test.tsx deleted file mode 100644 index e9f045a2..00000000 --- a/src/components/Modal/MajorModal/index.test.tsx +++ /dev/null @@ -1,36 +0,0 @@ -// TODO -// 1. MajorModal 컴포넌트 호출할 때, onClose & routerTo 를 props 로 전달 -// 2. 전달 받아서 호출 후, 테스트 할 내용은 2가지 -// 2-a. 학과 선택하러가기 버튼을 클릭하면 페이지 이동이 제대로 되는지 확인 -// 2-b. 모달 창 바깥 버튼 누르면 제대로 닫히는지 확인 -import { render, screen } from '@testing-library/react'; -import userEvent from '@testing-library/user-event'; -import { MemoryRouter } from 'react-router-dom'; - -import MajorModal from '.'; - -const onCloseMock = jest.fn(); -const routerToMock = jest.fn(); -jest.mock('react-router-dom', () => ({ - ...jest.requireActual('react-router-dom'), - useNavigate: () => routerToMock, -})); - -describe('모달 컴포넌트 테스트', () => { - it('학과 선택 페이지로의 이동이 제대로 되는지 테스트', async () => { - render( - , - { - wrapper: MemoryRouter, - }, - ); - - const pageButton = screen.getByText('학과 선택하기'); - await userEvent.click(pageButton); - - expect(routerToMock).toHaveBeenCalledWith('major-decision'); - }); -}); diff --git a/src/components/Modal/MajorModal/index.tsx b/src/components/Modal/MajorModal/index.tsx deleted file mode 100644 index 475985f8..00000000 --- a/src/components/Modal/MajorModal/index.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import Button from '@components/Button'; -import Icon from '@components/Icon'; -import { css } from '@emotion/react'; -import { THEME } from '@styles/ThemeProvider/theme'; - -import Modal from '..'; - -interface MajorModalProps { - onClose: () => void; - routerTo: () => void; -} - -const MajorModal = ({ onClose, routerTo }: MajorModalProps) => { - return ( - - <> - - 아직 학과를 알려주지 않았어요 - - - - - ); -}; - -export default MajorModal; diff --git a/src/components/Modal/MapBoundsLimitModal/index.tsx b/src/components/Modal/MapBoundsLimitModal/index.tsx deleted file mode 100644 index d5c093f2..00000000 --- a/src/components/Modal/MapBoundsLimitModal/index.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import Modal from '@components/Modal'; -import { css } from '@emotion/react'; -import { THEME } from '@styles/ThemeProvider/theme'; -import React from 'react'; - -interface MapBoundsLimitModal { - onClose: () => void; -} - -const MapBoundsLimitModal = ({ onClose }: MapBoundsLimitModal) => { - return ( - - <> - - 앗! 지도의 범위를 벗어났어요. - - - - ); -}; - -export default MapBoundsLimitModal; diff --git a/src/components/Modal/MapLevelLimitModal/index.tsx b/src/components/Modal/MapLevelLimitModal/index.tsx deleted file mode 100644 index 3a50d516..00000000 --- a/src/components/Modal/MapLevelLimitModal/index.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { css } from '@emotion/react'; -import { THEME } from '@styles/ThemeProvider/theme'; - -import Modal from '..'; - -interface MapLevetLimitModalProps { - onClose: () => void; -} - -const MapLevetLimitModal = ({ onClose }: MapLevetLimitModalProps) => { - return ( - - <> - - 앗! 지도를 더이상 축소할 수 없어요 - - - - ); -}; - -export default MapLevetLimitModal; diff --git a/src/components/Modal/SuggestionModal/SuggestionInput.tsx b/src/components/Modal/SuggestionModal/SuggestionInput.tsx deleted file mode 100644 index 05f8999b..00000000 --- a/src/components/Modal/SuggestionModal/SuggestionInput.tsx +++ /dev/null @@ -1,87 +0,0 @@ -import http from '@apis/http'; -import Button from '@components/Button'; -import { SERVER_URL } from '@config/index'; -import { css } from '@emotion/react'; -import styled from '@emotion/styled'; -import { THEME } from '@styles/ThemeProvider/theme'; -import { areaResize } from '@utils/styles/textarea-resize'; -import React, { Dispatch, SetStateAction, useRef, useState } from 'react'; - -interface SuggestionInputProps { - setIsSended: Dispatch>; -} - -const SuggestionInput = ({ setIsSended }: SuggestionInputProps) => { - const areaRef = useRef(null); - const [isInvalid, setIsInvalid] = useState(true); - - const onChange = (e: React.ChangeEvent) => { - if (!e.currentTarget.value || e.currentTarget.value.length < 5) { - setIsInvalid(true); - return; - } - setIsInvalid(false); - }; - const onResize = (e: React.KeyboardEvent) => { - areaResize(e.currentTarget); - }; - - const onSuggest = async () => { - setIsSended((prev) => !prev); - await http.post( - `${SERVER_URL}/api/suggestion`, - { - content: areaRef.current?.value, - }, - { - headers: { - 'Content-Type': 'application/json', - }, - }, - ); - }; - - return ( - <> - - 건의사항 - - - - - ); -}; - -export default SuggestionInput; - -const TextArea = styled.textarea` - line-height: 1.5; - padding: 10px; - resize: none; - overflow-y: hidden; - - font-size: 16px; - font-weight: bold; - border-radius: 8px; - - &::placeholder { - color: ${THEME.TEXT.GRAY}; - font-weight: lighter; - } -`; diff --git a/src/components/Modal/SuggestionModal/SuggestionThxMessage.tsx b/src/components/Modal/SuggestionModal/SuggestionThxMessage.tsx deleted file mode 100644 index 88e0ecf0..00000000 --- a/src/components/Modal/SuggestionModal/SuggestionThxMessage.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { css } from '@emotion/react'; - -const SuggestionThxMessage = () => { - return ( - <> - - 🙇‍♂️ 건의사항을 남겨 주셔서 정말 감사드립니다! 🙇‍♂️
더 좋은 서비스를 - 제공할 수 있도록 노력하겠습니다. -
- - ); -}; - -export default SuggestionThxMessage;