diff --git a/frontend/src/components/MyPage/MyPagePostButton/MyPagePostButton.tsx b/frontend/src/components/MyPage/MyPagePostButton/MyPagePostButton.tsx index cbd541ad6..888fb8c19 100644 --- a/frontend/src/components/MyPage/MyPagePostButton/MyPagePostButton.tsx +++ b/frontend/src/components/MyPage/MyPagePostButton/MyPagePostButton.tsx @@ -6,16 +6,18 @@ import { usePageRouter } from '@/hooks/usePageRouter'; import useViewport from '@/hooks/useViewport'; import { ReviewStatus } from '@/types/runnerPost'; -import React, { useContext, useMemo } from 'react'; +import React, { useContext } from 'react'; +import styled from 'styled-components'; interface Props { runnerPostId: number; reviewStatus: ReviewStatus; isRunner: boolean; supporterId?: number; + handleDeletePost: (handleDeletePost: number) => void; } -const MyPagePostButton = ({ runnerPostId, reviewStatus, isRunner, supporterId }: Props) => { +const MyPagePostButton = ({ runnerPostId, reviewStatus, isRunner, supporterId, handleDeletePost }: Props) => { const { goToSupportSelectPage, goToSupporterFeedbackPage } = usePageRouter(); const { isMobile } = useViewport(); @@ -27,14 +29,15 @@ const MyPagePostButton = ({ runnerPostId, reviewStatus, isRunner, supporterId }: patchRequestWithAuth(`/posts/runner/${runnerPostId}/cancelation`, async (response) => { showCompletionToast(TOAST_COMPLETION_MESSAGE.REVIEW_CANCEL); - setTimeout(window.location.reload, 2000); + handleDeletePost(runnerPostId); }); }; const finishReview = () => { patchRequestWithAuth(`/posts/runner/${runnerPostId}/done`, async (response) => { showCompletionToast(TOAST_COMPLETION_MESSAGE.REVIEW_COMPLETE); - setTimeout(window.location.reload, 2000); + + handleDeletePost(runnerPostId); }); }; @@ -68,42 +71,48 @@ const MyPagePostButton = ({ runnerPostId, reviewStatus, isRunner, supporterId }: switch (reviewStatus) { case 'NOT_STARTED': return ( - + + + ); case 'IN_PROGRESS': return isRunner ? null : ( - + + + ); case 'DONE': return isRunner ? ( - + + + ) : null; default: return null; @@ -111,3 +120,14 @@ const MyPagePostButton = ({ runnerPostId, reviewStatus, isRunner, supporterId }: }; export default MyPagePostButton; + +const S = { + PostButtonWrapper: styled.div` + width: 180px; + + @media (max-width: 768px) { + width: 100%; + margin-top: 18px; + } + `, +}; diff --git a/frontend/src/components/MyPage/MyPagePostItem/MyPagePostItem.tsx b/frontend/src/components/MyPage/MyPagePostItem/MyPagePostItem.tsx index 95eaba401..6f64ab660 100644 --- a/frontend/src/components/MyPage/MyPagePostItem/MyPagePostItem.tsx +++ b/frontend/src/components/MyPage/MyPagePostItem/MyPagePostItem.tsx @@ -11,6 +11,7 @@ import useViewport from '@/hooks/useViewport'; interface Props extends MyPagePost { isRunner: boolean; + handleDeletePost: (handleDeletePost: number) => void; } const MyPagePostItem = ({ @@ -23,6 +24,7 @@ const MyPagePostItem = ({ applicantCount, isRunner, supporterId, + handleDeletePost, }: Props) => { const { goToRunnerPostPage } = usePageRouter(); @@ -34,73 +36,41 @@ const MyPagePostItem = ({ return ( - {isMobile && ( - <> - {title} - - {deadline.replace('T', ' ')} 까지 - - - - )} - - {!isMobile && ( - <> - {title} - - {deadline.replace('T', ' ')} 까지 - - - - )} - - {tags.map((tag, index) => ( - #{tag} - ))} - - - - - - - {watchedCount} - - {applicantCount} - - - {!isMobile && ( - - - - )} - + {title} + + + {watchedCount} + + {applicantCount} + - {isMobile && ( + + {deadline.replace('T', ' ')} 까지 + + + + + + {tags.map((tag, index) => ( + #{tag} + ))} + + - )} + ); }; @@ -138,6 +108,9 @@ const S = { SideContainer: styled.div` display: flex; justify-content: space-between; + align-items: end; + + gap: 12px; `, PostTitle: styled.p` @@ -160,7 +133,7 @@ const S = { `, DeadLine: styled.p` - margin-bottom: 60px; + margin-bottom: 40px; color: var(--gray-600); @@ -171,43 +144,28 @@ const S = { } `, - TagContainer: styled.div` - & span { - margin-right: 10px; - - font-size: 14px; - color: var(--gray-600); - } - `, - Tag: styled.span``, + TagContainer: styled.div``, - LeftSideContainer: styled.div``, + Tag: styled.span` + margin-right: 10px; - RightSideContainer: styled.div` - display: flex; - flex-direction: column; - justify-content: end; - gap: 15px; + font-size: 14px; + color: var(--gray-600); - & button:hover { - transition: all 0.3s ease; - background-color: var(--baton-red); - color: var(--white-color); + @media (max-width: 768px) { + font-size: 14px; } `, - PostButtonWrapper: styled.div` - padding-left: auto; - width: 140px; - `, - - ChatViewContainer: styled.div` + BottomContainer: styled.div` display: flex; - justify-content: end; - - gap: 10px; + justify-content: space-between; + align-items: end; - font-size: 12px; + @media (max-width: 768px) { + flex-direction: column; + align-items: start; + } `, statisticsContainer: styled.div` @@ -226,9 +184,18 @@ const S = { width: 20px; margin-left: 8px; + + @media (max-width: 768px) { + width: 15px; + margin-left: 4px; + } `, statisticsText: styled.p` font-size: 14px; + + @media (max-width: 768px) { + font-size: 12px; + } `, }; diff --git a/frontend/src/components/MyPage/MyPagePostList/MyPagePostList.tsx b/frontend/src/components/MyPage/MyPagePostList/MyPagePostList.tsx index 50466005f..d0a2cf687 100644 --- a/frontend/src/components/MyPage/MyPagePostList/MyPagePostList.tsx +++ b/frontend/src/components/MyPage/MyPagePostList/MyPagePostList.tsx @@ -6,15 +6,16 @@ import MyPagePostItem from '../MyPagePostItem/MyPagePostItem'; interface Props { filteredPostList: MyPagePost[]; isRunner: boolean; + handleDeletePost: (handleDeletePost: number) => void; } -const MyPagePostList = ({ filteredPostList, isRunner }: Props) => { +const MyPagePostList = ({ filteredPostList, isRunner, handleDeletePost }: Props) => { if (filteredPostList?.length === 0) return

게시글 정보가 없습니다.

; return ( {filteredPostList?.map((item: MyPagePost) => ( - + ))} ); diff --git a/frontend/src/components/RunnerPost/RunnerPostItem/RunnerPostItem.tsx b/frontend/src/components/RunnerPost/RunnerPostItem/RunnerPostItem.tsx index 74d698d63..bbf15c434 100644 --- a/frontend/src/components/RunnerPost/RunnerPostItem/RunnerPostItem.tsx +++ b/frontend/src/components/RunnerPost/RunnerPostItem/RunnerPostItem.tsx @@ -29,6 +29,7 @@ const RunnerPostItem = ({ {deadline.replace('T', ' ')} 까지