Skip to content

Commit bbb0533

Browse files
authored
Merge pull request #156 from D3vPals/feat/#155
모달창 디자인 수정 및 적용/notFound 페이지 생성
2 parents 6091999 + 6cb1955 commit bbb0533

File tree

18 files changed

+1879
-35
lines changed

18 files changed

+1879
-35
lines changed

src/assets/notFoundImg.svg

Lines changed: 1699 additions & 0 deletions
Loading

src/components/common/header/Header.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@ import { useMyProfileInfo } from '../../../hooks/useMyInfo';
1010
import DefaultImg from '../../../assets/defaultImg.png';
1111
import { UserCircleIcon } from '@heroicons/react/24/outline';
1212
import loadingImg from '../../../assets/loadingImg.svg';
13+
import { useModal } from '../../../hooks/useModal';
14+
import Modal from '../modal/Modal';
1315

1416
function Header() {
15-
const { userLogout } = useAuth();
17+
const { isOpen, message, handleModalOpen, handleModalClose } = useModal();
18+
const { userLogout } = useAuth(handleModalOpen);
1619
const { isLoggedIn } = useAuthStore((state) => state);
1720
const { myData, isLoading } = useMyProfileInfo();
1821

@@ -64,6 +67,9 @@ function Header() {
6467
</>
6568
</DropDown>
6669
</nav>
70+
<Modal isOpen={isOpen} onClose={handleModalClose}>
71+
{message}
72+
</Modal>
6773
</S.HeaderContainer>
6874
);
6975
}

src/components/common/modal/Modal.styled.ts

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,28 +41,45 @@ export const ModalCloseButton = styled.button`
4141
position: absolute;
4242
top: 0;
4343
right: 0;
44-
padding: 12px;
44+
margin: 0.8rem;
45+
background: #ccc;
46+
border-radius: 50%;
47+
padding: 0.1rem;
4548
4649
svg {
47-
color: #fff;
50+
color: ${({ theme }) => theme.color.white};
4851
width: 20px;
4952
height: 20px;
5053
}
5154
`;
5255

56+
export const ModalIconWrapper = styled.div`
57+
margin-bottom: 1rem;
58+
59+
svg {
60+
color: #385a91;
61+
width: 40px;
62+
height: 40px;
63+
}
64+
`;
65+
5366
export const ModalContents = styled.p`
54-
font-size: 2rem;
67+
font-size: 1.1rem;
5568
font-weight: 600;
56-
color: ${({ theme }) => theme.color.white};
69+
color: #393939;
70+
text-align: center;
5771
`;
5872

5973
export const ModalBody = styled.div`
74+
display: flex;
75+
flex-direction: column;
76+
align-items: center;
6077
position: absolute;
6178
top: 50%;
6279
left: 50%;
6380
transform: translate(-50%, -50%);
64-
padding: 56px 32px 32px;
81+
padding: 4rem 3rem;
6582
border-radius: ${({ theme }) => theme.borderRadius.primary};
66-
background-color: ${({ theme }) => theme.color.navy};
83+
background-color: ${({ theme }) => theme.color.white};
6784
max-width: 80%;
6885
`;

src/components/common/modal/Modal.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useRef, useState } from 'react';
22
import { createPortal } from 'react-dom';
3-
import { XMarkIcon } from '@heroicons/react/24/outline';
3+
import { XMarkIcon, CheckCircleIcon } from '@heroicons/react/24/outline';
44
import * as S from './Modal.styled';
55
import ScrollPreventor from './ScrollPreventor';
66
interface ModalProps {
@@ -43,6 +43,9 @@ const Modal = ({ children, isOpen, onClose }: ModalProps) => {
4343
<S.ModalCloseButton onClick={handleClose}>
4444
<XMarkIcon />
4545
</S.ModalCloseButton>
46+
<S.ModalIconWrapper>
47+
<CheckCircleIcon />
48+
</S.ModalIconWrapper>
4649
<S.ModalContents>{children}</S.ModalContents>
4750
</S.ModalBody>
4851
</S.ModalContainer>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import styled from 'styled-components';
2+
import notFoundImg from '../../../../assets/notFoundImg.svg';
3+
4+
export const Container = styled.div`
5+
width: 100vw;
6+
height: 100vh;
7+
background-image: url(${notFoundImg});
8+
background-size: cover;
9+
background-position: center;
10+
background-repeat: no-repeat;
11+
12+
position: relative;
13+
`;
14+
15+
export const BackButton = styled.button`
16+
position: absolute;
17+
bottom: 15%;
18+
left: 50%;
19+
transform: translate(-50%, -50%);
20+
21+
padding: 10px 20px;
22+
font-size: 1rem;
23+
font-weight: 500;
24+
color: white;
25+
background-color: #3e404d;
26+
border: none;
27+
border-radius: 10px;
28+
cursor: pointer;
29+
transition: background-color 0.3s;
30+
31+
&:hover {
32+
background-color: #0056b3;
33+
}
34+
`;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { useNavigate } from 'react-router-dom';
2+
import * as S from './NotFoundPage.styled';
3+
4+
const NotFoundPage = () => {
5+
const navigate = useNavigate();
6+
7+
const handleBack = () => {
8+
navigate(-1);
9+
};
10+
return (
11+
<S.Container>
12+
<S.BackButton onClick={handleBack}>뒤로 가기</S.BackButton>
13+
</S.Container>
14+
);
15+
};
16+
17+
export default NotFoundPage;

src/components/common/sidebar/editMyProfileImg/EditMyProfileImg.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@ import React from 'react';
22
import { useUploadProfileImg } from '../../../../hooks/useMyInfo';
33
import * as S from './EditMyProfileImg.styled';
44
import { PhotoIcon } from '@heroicons/react/24/outline';
5+
import { useModal } from '../../../../hooks/useModal';
6+
import Modal from '../../modal/Modal';
57

68
const EditMyProfileImg = () => {
7-
const { uploadProfileImg } = useUploadProfileImg();
9+
const { isOpen, message, handleModalOpen, handleModalClose } = useModal();
10+
const { uploadProfileImg } = useUploadProfileImg(handleModalOpen);
811

912
const handleFileChange = (e: React.ChangeEvent<HTMLInputElement>) => {
1013
const file = e.target.files?.[0];
@@ -24,6 +27,9 @@ const EditMyProfileImg = () => {
2427
onChange={handleFileChange}
2528
/>
2629
</label>
30+
<Modal isOpen={isOpen} onClose={handleModalClose}>
31+
{message}
32+
</Modal>
2733
</S.Container>
2834
);
2935
};

src/components/mypage/myProfile/myProfile.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ import { Link } from 'react-router-dom';
2323
import BeginnerIcon from '../../../assets/beginner.svg';
2424
import OptionBox from './optionBox';
2525
import TextareaAutosize from 'react-textarea-autosize';
26+
import Modal from '../../common/modal/Modal';
27+
import { useModal } from '../../../hooks/useModal';
28+
import Spinner from '../Spinner';
2629

2730
const profileSchema = z.object({
2831
nickname: z
@@ -76,7 +79,8 @@ const MyProfile = () => {
7679
useNickNameVerification();
7780

7881
const { myData, isLoading } = useMyProfileInfo();
79-
const { editMyProfile } = useEditMyProfileInfo();
82+
const { isOpen, message, handleModalOpen, handleModalClose } = useModal();
83+
const { editMyProfile } = useEditMyProfileInfo(handleModalOpen);
8084

8185
const {
8286
control,
@@ -139,8 +143,9 @@ const MyProfile = () => {
139143
};
140144

141145
if (isLoading) {
142-
return <div>로딩중...</div>;
146+
return <Spinner size='50px' color='#3e5879;' />;
143147
}
148+
144149
if (!myData) {
145150
return <div>유저 정보를 불러 올 수 없습니다.</div>;
146151
}
@@ -525,6 +530,9 @@ const MyProfile = () => {
525530
</form>
526531
)}
527532
</S.Container>
533+
<Modal isOpen={isOpen} onClose={handleModalClose}>
534+
{message}
535+
</Modal>
528536
</S.Box>
529537
);
530538
};

src/constants/modalMessage.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@ export const MODAL_MESSAGE = {
22
pass: '지원자를 합격 리스트에 추가했습니다.',
33
nonPass: '지원자를 불합격 리스트에 추가했습니다.',
44
equalStatus: '이미 동일한 리스트에 추가하신 상태입니다.',
5-
signUp: '회원가입에 성공하셨습니다!',
6-
login: '로그인 되었습니다.',
5+
signUpSuccess: '회원가입 완료되었습니다.',
6+
signUpFail: '회원가입 실패하였습니다.',
7+
changePasswordSuccess: '비밀번호가 성공적으로 재설정 되었습니다.',
8+
changePasswordFail: '비밀번호 재설정에 실패하였습니다.',
9+
loginSuccess: '로그인 되었습니다.',
10+
loginFail: '가입되지 않은 계정입니다.',
11+
logout: '로그아웃 되었습니다.',
12+
myProfileSuccess: '프로필 수정이 완료되었습니다.',
13+
myProfileFail: '프로필 수정에 실패했습니다.',
14+
profileImgSuccess: '프로필 이미지가 업로드 되었습니다.',
15+
profileImgFail: '이미지는 5MB 이하, .png.jpg.jpeg.svg 형식만 가능합니다.',
716
} as const;

src/constants/routes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ export const ROUTES = {
1515
userpage: '/user',
1616
userJoinedProject: 'join-projects',
1717
modifyProject: '/project-modify',
18+
notFound: '/not-found',
1819
} as const;

0 commit comments

Comments
 (0)