diff --git a/src/App.js b/src/App.js index c468df71..cfa866d3 100644 --- a/src/App.js +++ b/src/App.js @@ -3,10 +3,6 @@ import { useState, createContext, useEffect } from 'react'; import './App.css'; import { jwtDecode } from 'jwt-decode'; import { toast, Toaster } from 'sonner'; -import { useLocation } from 'react-router-dom'; - -import { MainHeader } from './components/headerRefactor/MainHeader'; -import { SubHeader } from './components/headerRefactor/SubHeader'; // 메인 컴포넌트 import StartLoading from './pages/main/landing/StartLoading.js'; diff --git a/src/components/headerRefactor/SubHeader.js b/src/components/headerRefactor/SubHeader.js index 5ec8ed60..b3e3139d 100644 --- a/src/components/headerRefactor/SubHeader.js +++ b/src/components/headerRefactor/SubHeader.js @@ -1,25 +1,35 @@ import styled from 'styled-components'; -import { useNavigate } from 'react-router-dom'; +import { useNavigate, useLocation } from 'react-router-dom'; import COLORS from 'theme'; import backArrow from '../../assets/image/backArrow.png'; import user from '../../assets/image/user.png'; import searchWhite from 'assets/image/searchWhite.png'; -export const SubHeader = ({ text }) => { +export const SubHeader = ({ text, customBackLink }) => { const token = localStorage.getItem('accessToken'); const navigate = useNavigate(); + const location = useLocation(); const handleUserClick = () => { if (token) { - navigate('/mypage'); // 유저 아이콘 클릭 시 /my-page로 이동 + navigate('/mypage'); // 유저 아이콘 클릭 시 /mypage로 이동 } else { - navigate('/login'); // 로그인 텍스트 클릭 시 /login-page로 이동 + navigate('/login'); // 로그인 텍스트 클릭 시 /login으로 이동 } }; const handleGoBack = () => { - navigate(-1); // 뒤로 가기 + // 커스텀 링크가 제공된 경우 해당 링크로 이동 + if (customBackLink) { + navigate(customBackLink); + } else if (location.state?.from) { + // location.state에 이전 페이지 정보가 있는 경우 해당 경로로 이동 + navigate(-1); + } else { + // 기본적으로 홈으로 이동하거나 다른 기본 경로 설정 가능 + navigate('/'); + } }; return ( @@ -29,8 +39,7 @@ export const SubHeader = ({ text }) => { {text} - - {/* */} + ); diff --git a/src/pages/buddy/accept/BuddyAccept.js b/src/pages/buddy/accept/BuddyAccept.js index fc8fbff8..f5882a1e 100644 --- a/src/pages/buddy/accept/BuddyAccept.js +++ b/src/pages/buddy/accept/BuddyAccept.js @@ -62,7 +62,6 @@ const BuddyAccept = () => { isAccept: accept, }; - fetch(process.env.REACT_APP_BACK_SERVER + '/buddy/matching/status', { method: 'POST', body: JSON.stringify(acceptInfo), @@ -74,7 +73,7 @@ const BuddyAccept = () => { }) .then(response => response.json()) .then(data => { - console.log(data) + console.log(data); if (accept) { toast.success( '매칭이 수락되었습니다! \n상대방이 매칭을 수락할 때까지 기다려주세요.' @@ -109,7 +108,7 @@ const BuddyAccept = () => { return (
- +

버디를 찾았습니다!

findBuddy diff --git a/src/pages/buddy/info/BuddyStart1.js b/src/pages/buddy/info/BuddyStart1.js index 5b0b3577..73b76f65 100644 --- a/src/pages/buddy/info/BuddyStart1.js +++ b/src/pages/buddy/info/BuddyStart1.js @@ -42,7 +42,7 @@ const BuddyStart1 = () => { return ( <> - +
{/* */}
diff --git a/src/pages/buddy/info/BuddyStart2.js b/src/pages/buddy/info/BuddyStart2.js index 54dafcef..2ec75e9e 100644 --- a/src/pages/buddy/info/BuddyStart2.js +++ b/src/pages/buddy/info/BuddyStart2.js @@ -16,7 +16,7 @@ const BuddyStart2 = () => { return (
- +
{/*
*/} BuddyStart diff --git a/src/pages/buddy/matching/js/Buddy_Matching.js b/src/pages/buddy/matching/js/Buddy_Matching.js index 723fe7de..5628802a 100644 --- a/src/pages/buddy/matching/js/Buddy_Matching.js +++ b/src/pages/buddy/matching/js/Buddy_Matching.js @@ -96,7 +96,7 @@ const Buddy_Matching = () => { return (
- +
diff --git a/src/pages/buddy/success/BuddySuccess.js b/src/pages/buddy/success/BuddySuccess.js index 00e65b80..187c5a52 100644 --- a/src/pages/buddy/success/BuddySuccess.js +++ b/src/pages/buddy/success/BuddySuccess.js @@ -8,6 +8,7 @@ import buddySucces from '../../../assets/image/buddySuccess.png'; import prev from '../../../assets/image/back_gray.png'; import next from '../../../assets/image/next_gray.png'; import style from './BuddySuccess.module.css'; +import { SubHeader } from 'components/headerRefactor/SubHeader'; const BuddySuccess = () => { const [major, setMajor] = useState(''); @@ -105,6 +106,7 @@ const BuddySuccess = () => { return (
+

버디를 찾았습니다!

buddySucces diff --git a/src/pages/buddy/success/BuddySuccess.module.css b/src/pages/buddy/success/BuddySuccess.module.css index a692f279..0d0d8cbd 100644 --- a/src/pages/buddy/success/BuddySuccess.module.css +++ b/src/pages/buddy/success/BuddySuccess.module.css @@ -1,11 +1,10 @@ .container { - margin-top: 8vh; display: flex; flex-direction: column; height: 90%; background-color: #fafafa; align-items: center; - justify-content: space-evenly; + gap: 10px; /* overflow: hidden; */ } .title { @@ -21,13 +20,13 @@ max-height: 320px; } -.info_container{ +.info_container { width: 90%; height: 23vh; position: relative; overflow: hidden; } -.prev{ +.prev { position: fixed; width: 5%; height: 7%; @@ -37,7 +36,7 @@ z-index: 2; cursor: pointer; } -.next{ +.next { position: fixed; width: 5%; height: 7%; @@ -47,8 +46,8 @@ z-index: 2; cursor: pointer; } -@media (min-width: 450px){ - .prev{ +@media (min-width: 450px) { + .prev { position: fixed; width: 3%; height: 7%; @@ -57,7 +56,7 @@ z-index: 2; cursor: pointer; } - .next{ + .next { position: fixed; width: 3%; height: 7%; @@ -66,28 +65,27 @@ z-index: 2; cursor: pointer; } - .info_container{ + .info_container { width: 62%; height: 23vh; position: relative; overflow: hidden; } - .go_home{ + .go_home { width: 40vw; height: 8.5vh; max-height: 56px; max-width: 380px; - background-color: #FF4B4B; + background-color: #ff4b4b; border-radius: 28px; - color: #FFFFFF; + color: #ffffff; font-size: 1.3rem; font-weight: 700; margin-top: 4%; cursor: pointer; + } } - -} -.inner_container{ +.inner_container { width: 300%; height: 100%; display: flex; @@ -135,31 +133,30 @@ padding: 0 5%; } .kakao_title { - font-weight: 700; - color: #111111; + font-weight: 700; + color: #111111; } .kakao_id { - color: #777777; + color: #777777; } - -.tip{ +.tip { color: #111111; margin: 1% 0; font-weight: 700; } -.go_home{ - width: 90%; - height: 8.5vh; - max-height: 56px; - max-width: 380px; - background-color: #FF4B4B; - border-radius: 28px; - color: #FFFFFF; - font-size: 1.3rem; - font-weight: 700; - margin: 1% 0; - cursor: pointer; +.go_home { + width: 90%; + height: 8.5vh; + max-height: 56px; + max-width: 380px; + background-color: #ff4b4b; + border-radius: 28px; + color: #ffffff; + font-size: 1.3rem; + font-weight: 700; + margin: 1% 0; + cursor: pointer; } .cancelBtn { font-size: 1.1rem; diff --git a/src/pages/buddy/waiting/BuddyWaiting.js b/src/pages/buddy/waiting/BuddyWaiting.js index 53bb7ecf..9aaa1013 100644 --- a/src/pages/buddy/waiting/BuddyWaiting.js +++ b/src/pages/buddy/waiting/BuddyWaiting.js @@ -111,7 +111,7 @@ const BuddyWaiting = () => { return (
- +

세종버디

diff --git a/src/pages/honbob/info/HonbobStart1.js b/src/pages/honbob/info/HonbobStart1.js index c1bf9624..ecf56926 100644 --- a/src/pages/honbob/info/HonbobStart1.js +++ b/src/pages/honbob/info/HonbobStart1.js @@ -47,7 +47,7 @@ const HonbobStart1 = () => { return (

- +