Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FE] 리뷰 상세 페이지에 react-query 추가 및 리팩토링 #161

Merged
merged 36 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
e3eaa42
fix: src/index.tsx에서 enableMocking 제거
BadaHertz52 Jul 26, 2024
0cb8d19
feat: 리뷰 그룹 생성 시 코멘트 컴포넌트명 변경 및 기본값 설정
BadaHertz52 Jul 27, 2024
0a4cec6
refactor: 서버 DB에 있는 리뷰 데이터를 사용하기 위한 상수화
BadaHertz52 Jul 27, 2024
19fa32b
feat : QueryClient, QueryClientProvider 적용
BadaHertz52 Jul 27, 2024
339c22c
fix: dependencies에 있는 테스트 패키지들을 devDependencies로 옮김
BadaHertz52 Jul 27, 2024
90f1784
feat: 리뷰 상세페이지에 react-query 적용
BadaHertz52 Jul 27, 2024
f2e96a7
feat : msw에 리뷰 상세페이지 404 오류 추가
BadaHertz52 Jul 27, 2024
9721bda
ci: react-error-boundary 설치
BadaHertz52 Jul 27, 2024
9e31285
feat: Outlet에 QueryErrorResetBoundary,ErrorBoundary, Suspense 적용
BadaHertz52 Jul 27, 2024
251af38
feat: 리뷰 상세페이지에 useSuspenseQuery 적용
BadaHertz52 Jul 27, 2024
e45ddb4
refactor: 리뷰 상세페이지 resource, queryString key 상수화
BadaHertz52 Jul 27, 2024
41d8fb8
refactor: 리뷰 상세페이지 react-query key 상수화
BadaHertz52 Jul 27, 2024
54d927c
refactor: 리뷰 상세 페이지 컴포넌트 속에서만 사용하는 상수들 상수화
BadaHertz52 Jul 27, 2024
df18d3a
refactor: DetailedReviewPage/components에 index.tsx를 추가해 import 경로 간결하…
BadaHertz52 Jul 27, 2024
da20f40
fix: src/index.tsx에서 enableMocking 삭제
BadaHertz52 Jul 28, 2024
3783ed7
feat: error 전파를 위한 QueryClient 옵션 추가
BadaHertz52 Jul 28, 2024
80ca5a2
Merge branch 'develop' of https://github.com/woowacourse-teams/2024-r…
BadaHertz52 Jul 31, 2024
528eb22
Merge branch 'develop' of https://github.com/woowacourse-teams/2024-r…
BadaHertz52 Jul 31, 2024
6af1a65
fix: ErrorPage의 SideModal에 closeModal props로 줌
BadaHertz52 Jul 31, 2024
91d0a55
refactor: ErrorSection 위치 변경(src/pages/ErrorPage -> src/components/er…
BadaHertz52 Jul 31, 2024
d13fdfd
feat: ErrorFallback 컴포넌트 생성
BadaHertz52 Jul 31, 2024
f20698f
feat: ErrorSuspenseContainer 생성 및 App.tsx에 적용
BadaHertz52 Jul 31, 2024
f552fcf
chore: constants/index.ts export 경로 변경
BadaHertz52 Jul 31, 2024
d6d7696
chore: 3차-1주차 핵심 기능 시현 때 필요 없는 코드 주석 처리
BadaHertz52 Jul 31, 2024
9745350
docs: ErrorPage의 ERROR_MESSAGE 수정
BadaHertz52 Jul 31, 2024
67e2c5a
design: formWidth 변경 및 fontSize에 1.4rem 추가
BadaHertz52 Jul 31, 2024
4415a36
feat: 리뷰 상세 페이지에 리뷰이 이름 추가
BadaHertz52 Jul 31, 2024
872ff0b
refactor: 불필요한 export 삭제
BadaHertz52 Aug 1, 2024
bc93a51
chore: type명 수정 (RevieweeCommentProps =>RevieweeCommentsProps)
BadaHertz52 Aug 1, 2024
3032874
refactor: ErrorSection으l Button 수정
BadaHertz52 Aug 1, 2024
52f8de6
refactor: 리뷰 상세 페이지 데이터 타입 변경에 따른 수정
BadaHertz52 Aug 1, 2024
c148246
refactor: ErrorSuspenseContainer 적용 위치 변경
BadaHertz52 Aug 1, 2024
0da75a9
refactor: 리뷰 상세 페이지 데이터 타입 강제 방법 변경
BadaHertz52 Aug 1, 2024
88a2c23
chore: 불필요한 주석 삭제
BadaHertz52 Aug 1, 2024
79ee76b
refactor: ErrorSection의 buttons 네이밍 변경 및 요소에 key 추가
BadaHertz52 Aug 1, 2024
abe9154
chore: 스타일 주석에 NOTE 추가
BadaHertz52 Aug 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@
"@emotion/styled": "^11.11.5",
"@tanstack/react-query": "^5.51.1",
"@tanstack/react-query-devtools": "^5.51.1",
"@testing-library/jest-dom": "^6.4.7",
"@testing-library/user-event": "^14.5.2",
"@types/jest": "^29.5.12",
"dotenv-webpack": "^8.1.0",
"jest": "^29.7.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-error-boundary": "^4.0.13",
"react-router": "^6.24.1",
"react-router-dom": "^6.24.1",
"jest": "^29.7.0"
"react-router-dom": "^6.24.1"
},
"devDependencies": {
"@babel/core": "^7.24.7",
Expand All @@ -33,7 +32,9 @@
"@emotion/babel-plugin": "^11.11.0",
"@stylelint/postcss-css-in-js": "^0.38.0",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.4.8",
"@testing-library/react": "^16.0.0",
"@testing-library/user-event": "^14.5.2",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^7.16.0",
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Outlet } from 'react-router';

import { Main, PageLayout, Sidebar, Topbar, SideModal } from './components';
import { Main, PageLayout, Sidebar, Topbar, SideModal, ErrorSuspenseContainer } from './components';
import { useSidebar } from './hooks';

const App = () => {
Expand All @@ -15,7 +15,9 @@ const App = () => {
)}
<Topbar openSidebar={openSidebar} />
<Main>
<Outlet />
<ErrorSuspenseContainer>
<Outlet />
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

렌더링 시 API를 불러오는 페이지가 있고 그렇지 못한 페이지가 있을 수 있어요.
그래서 ErrorBoundary, Suspense를 렌더링 시 API를 요청하는 페이지에만 적용하는 것을 시도해봤어요. 렌더링 시 API를 요청하는 페이지에서 아래처럼 시도를 해봤는데 Suspense가 Loading을 잡지 못했어요. 그레서 Outlet ErrorSuspenseContainer로 감싸는 방식을 선택하게 되었어요.

//Page.tsx
// PageContents: 렌더링 시 API 요청으로 데이터를 받아와 이를 화면에 보여줌
const Page =()=>{
return (
<ErrorSuspsensContainer>
  <PageContents/>
</ErrorSuspenseContainer>
)
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

라우팅 페이지에서 아래처럼 개별로 감싸 줘도 작동하지 않나요? 리액트 라우터 버전이 예전 거긴 하지만 혹시나 해서 가져왔습니다!

 <Route
        path="/lazy-one"
        element={(
          <Suspense fallback={<div>Loading...</div>}>
            <LazyOne />
          </Suspense>
        )}
      />

참고한 글

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오! 😮 router의 element안에서 필요한 페이지마다 적용하도록 하면 되네요!!

</ErrorSuspenseContainer>
</Main>
</PageLayout>
);
Expand Down
9 changes: 8 additions & 1 deletion frontend/src/apis/endpoints.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
export const DETAILED_REVIEW_API_PARAMS = {
resource: 'reviews',
queryString: {
memberId: 'memberId',
},
};

const endPoint = {
postingReview: `${process.env.API_BASE_URL}/reviews`,
gettingDetailedReview: (reviewId: number, memberId: number) =>
`${process.env.API_BASE_URL}/reviews/${reviewId}?memberId=${memberId}`,
`${process.env.API_BASE_URL}/${DETAILED_REVIEW_API_PARAMS.resource}/${reviewId}?${DETAILED_REVIEW_API_PARAMS.queryString.memberId}=${memberId}`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

추후에 필요한 queryString을 위와 같이 객체 형태로 받아, 요청 URL을 만들어주는 유틸 함수를 만들어도 좋을 것 같아요!

gettingDataToWriteReview: (reviewerGroupId: number) =>
`${process.env.API_BASE_URL}/reviews/write?reviewerGroupId=${reviewerGroupId}`,
gettingReviewList: (revieweeId: number, lastReviewId: number, memberId: number) =>
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/apis/review.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ReviewData, WritingReviewInfoData } from '@/types';
//리뷰 작성
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 주석이 추가된 이유가 있을까용?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

develop 받을 때 부터 있던 거라 누군가의 의도일거라 생각했는데 충돌 과정에서 제거되어야하는 주석이 살아있었나보네요. 삭제했어요.

import { DetailReviewData, ReviewData, WritingReviewInfoData } from '@/types';

import createApiErrorMessage from './apiErrorMessageCreator';
import endPoint from './endpoints';
Expand Down Expand Up @@ -46,7 +47,7 @@ export const getDetailedReviewApi = async ({ reviewId, memberId }: { reviewId: n
throw new Error(createApiErrorMessage(response.status));
}

const data = await response.json();
const data: DetailReviewData = await response.json();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

단순 궁금증인데 저는 두 번째 방법을 주로 사용해요. 첫 번째 방법으로 사용하신 이유가 있을까요

// 첫 번째 방법
 const data: DetailReviewData = await response.json();
  return data;
// 두 번째 방법
 const data = await response.json();
  return data as DetailReviewData;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

올리의 질문을 받고 첫 번째와 두 번째 방법의 차이와 어느 쪽이 더 나은 방향인지 찾아봤어요.

둘 다 타입 강제이지만 첫 번째 방법은 타입 추론이 정확하지 않을 수도 있다고 하네요. 타입을 강제하는 방면에서는 두 번째 코드가 나아서 두 번째 코드로 수정했어요.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(단순 궁금증) data의 타입이 자동으로 추론되지 않아서 추가한 부분인가요?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

네 맞습니다

return data;
};

Expand Down
11 changes: 0 additions & 11 deletions frontend/src/components/common/ReviewComment/index.tsx

This file was deleted.

13 changes: 13 additions & 0 deletions frontend/src/components/common/RevieweeComments/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import * as S from './styles';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comments 👍👍 전혀 몰랐읍니다


interface RevieweeCommentsProps {
comment: string;
}

const DEFAULT_COMMENTS = '안녕하세요! 리뷰 잘 부탁드립니다.';

const RevieweeComments = ({ comment }: RevieweeCommentsProps) => {
return <S.RevieweeComments>{comment || DEFAULT_COMMENTS}</S.RevieweeComments>;
};

export default RevieweeComments;
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import styled from '@emotion/styled';

export const ReviewComment = styled.p`
export const RevieweeComments = styled.p`
width: inherit;
height: 3rem;
margin-top: 1.6rem;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/common/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export { default as DropDown } from './DropDown';
export { default as SearchInput } from './SearchInput';
export { default as ProjectImg } from './ProjectImg';
export { default as ReviewDate } from './ReviewDate';
export { default as ReviewComment } from './ReviewComment';
export { default as RevieweeComments } from './RevieweeComments';
export { default as MultilineTextViewer } from './MultilineTextViewer';
export { default as TopButton } from './TopButton';
export * from './modals';
16 changes: 16 additions & 0 deletions frontend/src/components/error/ErrorFallback/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { FallbackProps } from 'react-error-boundary';
import { useNavigate } from 'react-router';

import ErrorSection from '../ErrorSection';

const ErrorFallback = ({ error, resetErrorBoundary }: FallbackProps) => {
const navigate = useNavigate();
const handleGoHome = () => {
resetErrorBoundary();
navigate('/'); //TODO : 홈 페이지 경로가 결정되면 변경
};
Comment on lines +6 to +11
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

errorBoundary에 전달되는 reset이 이렇게 사용되는군요! 👍


return <ErrorSection errorMessage={error.message} handleGoHome={handleGoHome} handleReload={resetErrorBoundary} />;
};

export default ErrorFallback;
22 changes: 22 additions & 0 deletions frontend/src/components/error/ErrorSuspenseContainer/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { QueryErrorResetBoundary } from '@tanstack/react-query';
import { Suspense } from 'react';
import { ErrorBoundary } from 'react-error-boundary';

import LoadingPage from '@/pages/LoadingPage';
import { EssentialPropsWithChildren } from '@/types';

import ErrorFallback from '../ErrorFallback';

const ErrorSuspenseContainer = ({ children }: EssentialPropsWithChildren) => {
return (
<QueryErrorResetBoundary>
{({ reset }) => (
<ErrorBoundary FallbackComponent={ErrorFallback} onReset={reset}>
<Suspense fallback={<LoadingPage />}>{children}</Suspense>
</ErrorBoundary>
)}
</QueryErrorResetBoundary>
);
};

export default ErrorSuspenseContainer;
2 changes: 2 additions & 0 deletions frontend/src/components/error/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default as ErrorSection } from './ErrorSection';
export { default as ErrorSuspenseContainer } from './ErrorSuspenseContainer';
1 change: 1 addition & 0 deletions frontend/src/components/index.tsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './layouts';
export * from './common';
export * from './error';
3 changes: 2 additions & 1 deletion frontend/src/components/layouts/Sidebar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useLocation, Link } from 'react-router-dom';

import CloseIcon from '@/assets/close.svg';
import LogoIcon from '@/assets/logo.svg';
import { DETAILED_PAGE_MOCK_API_SETTING_VALUES } from '@/mocks/mockData/detailedReviewMockData';

import { PAGE } from '../../../constants';

Expand All @@ -11,7 +12,7 @@ const PATH = {
myPage: '/user/mypage',
reviewWriting: '/user/review-writing',
reviewPreviewList: '/user/review-preview-list',
detailedReview: '/user/detailed-review/0?memberId=1',
detailedReview: `/user/detailed-review/${DETAILED_PAGE_MOCK_API_SETTING_VALUES.reviewId}?memberId=${DETAILED_PAGE_MOCK_API_SETTING_VALUES.memberId}`,
reviewGroupManagement: '/user/review-group-management',
};

Expand Down
1 change: 1 addition & 0 deletions frontend/src/constants/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './page';
export * from './apiErrorMessage';
export * from './review';
export * from './queryKeys';
3 changes: 3 additions & 0 deletions frontend/src/constants/queryKeys.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const REVIEW_QUERY_KEYS = {
detailedReview: 'detailedReview',
};
22 changes: 18 additions & 4 deletions frontend/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Global, ThemeProvider } from '@emotion/react';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import React from 'react';
import ReactDOM from 'react-dom/client';
import { createBrowserRouter, RouterProvider } from 'react-router-dom';
Expand All @@ -12,6 +13,17 @@ import ReviewWritingPage from './pages/ReviewWriting';
import globalStyles from './styles/globalStyles';
import theme from './styles/theme';

const queryClient = new QueryClient({
defaultOptions: {
queries: {
throwOnError: true,
},
mutations: {
throwOnError: true,
},
},
});

const router = createBrowserRouter([
{
path: '/',
Expand Down Expand Up @@ -42,9 +54,11 @@ const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement)

root.render(
<React.StrictMode>
<ThemeProvider theme={theme}>
<Global styles={globalStyles} />
<RouterProvider router={router} />
</ThemeProvider>
<QueryClientProvider client={queryClient}>
<ThemeProvider theme={theme}>
<Global styles={globalStyles} />
<RouterProvider router={router} />
</ThemeProvider>
</QueryClientProvider>
</React.StrictMode>,
);
28 changes: 23 additions & 5 deletions frontend/src/mocks/handlers/review.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,32 @@ import { http, HttpResponse } from 'msw';

import endPoint from '@/apis/endpoints';

import { DETAILED_REVIEW_MOCK_DATA } from '../mockData/detailedReviewMockData';
import {
DETAILED_REVIEW_MOCK_DATA,
DETAILED_PAGE_MOCK_API_SETTING_VALUES,
DETAILED_PAGE_ERROR_API_VALUES,
} from '../mockData/detailedReviewMockData';
import { REVIEW_PREVIEW_LIST } from '../mockData/reviewPreviewList';
import { REVIEW_WRITING_DATA } from '../mockData/reviewWritingData';

const getDetailedReview = () =>
http.get(endPoint.gettingDetailedReview(123456, 123456), async ({ request }) => {
return HttpResponse.json(DETAILED_REVIEW_MOCK_DATA);
});
http.get(
endPoint.gettingDetailedReview(
DETAILED_PAGE_MOCK_API_SETTING_VALUES.reviewId,
DETAILED_PAGE_MOCK_API_SETTING_VALUES.memberId,
),
async () => {
return HttpResponse.json(DETAILED_REVIEW_MOCK_DATA);
},
);

const getWrongDetailReview = () =>
http.get(
endPoint.gettingDetailedReview(DETAILED_PAGE_ERROR_API_VALUES.reviewId, DETAILED_PAGE_ERROR_API_VALUES.memberId),
async () => {
return HttpResponse.json({ error: '잘못된 상세리뷰 요청' }, { status: 404 });
},
);
Comment on lines +24 to +30
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

잘못된 요청에 대한 에러를 반환하는 핸들러를 만들었군요!

Comment on lines +24 to +30
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

에러가 발생했을 때의 핸들러도 만들어주셨네요👍


const getDataToWriteReview = () =>
http.get(endPoint.gettingDataToWriteReview(10), async ({ request }) => {
Expand All @@ -21,6 +39,6 @@ const getReviewPreviewList = () =>
return HttpResponse.json(REVIEW_PREVIEW_LIST);
});

const reviewHandler = [getDetailedReview(), getReviewPreviewList(), getDataToWriteReview()];
const reviewHandler = [getDetailedReview(), getWrongDetailReview(), getReviewPreviewList(), getDataToWriteReview()];

export default reviewHandler;
13 changes: 12 additions & 1 deletion frontend/src/mocks/mockData/detailedReviewMockData.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
import { DetailReviewData } from '@/types';

export const DETAILED_PAGE_MOCK_API_SETTING_VALUES = {
reviewId: 5,
memberId: 2,
};

export const DETAILED_PAGE_ERROR_API_VALUES = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

상수화가 잘 되어있어서 아래 모킹 핸들러에서 의도를 파악하기가 더 쉬웠어요~~ 굿굿

reviewId: 0,
memberId: 0,
};

const ANSWER =
'림순의 바람은 그윽한 산들바람처럼 잔잔하게 흘러갔습니다. \n 눈부신 햇살이 그의 어깨를 감싸며, 푸른 하늘 아래 펼쳐진 들판을 바라보았습니다.\n 그의 마음은 자연의 아름다움 속에서 평온을 찾았고, 그 순간마다 삶의 소중함을 느꼈습니다.\n 그는 늘 그러한 순간들을 기억하며, 미래의 나날들을 기대했습니다. \n 바람은 여전히 그를 감싸며, 그의 마음 속 깊은 곳에 있는 꿈과 희망을 불러일으켰습니다.\n 림순은 미소 지으며 앞으로 나아갔습니다.림순의 바람은 그윽한 산들바람처럼 잔잔하게 흘러갔습니다. \n 눈부신 햇살이 그의 어깨를 감싸며, 푸른 하늘 아래 펼쳐진 들판을 바라보았습니다.\n 그의 마음은 자연의 아름다움 속에서 평온을 찾았고, 그 순간마다 삶의 소중함을 느꼈습니다.\n 그는 늘 그러한 순간들을 기억하며, 미래의 나날들을 기대했습니다. 림순의 바람은 그윽한 산들바람처럼 잔잔하게 흘러갔습니다. \n 눈부신 햇살이 그의 어깨를 감싸며, 푸른 하늘 아래 펼쳐진 들판을 바라보았습니다.\n 그의 마음은 자연의 아름다움 속에서 평온을 찾았고, 그 순간마다 삶의 소중함을 느꼈습니다.\n 그는 늘 그러한 순간들을 기억하며, 미래의 나날들을 기대했습니다. \n 바람은 여전히 그를 감싸며, 그의 마음 속 깊은 곳에 있는 꿈과 희망을 불러일으켰습니다.\n 림순은 미소 지으며 앞으로 나아갔습니다.림순의 바람은 그윽한 산들바람처럼 잔잔하게 흘러갔습니다. \n 눈부신 햇살이 그의 어깨를 감싸며, 푸른 하늘 아래 펼쳐진 들판을 바라보았습니다.\n 그의 마음은 자연의 아름다움 속에서 평온을 찾았고, 그 순간마다 삶의 소중함을 느꼈습니다.\n 그는 늘 그러한 순간들을 기억하며, 미래의 나날들을 기대했습니다. ';

export const DETAILED_REVIEW_MOCK_DATA: DetailReviewData = {
id: 123456,
createdAt: new Date('2024-07-16'),
revieweeName: 'badahertz52',
isPublic: false,
reviewerGroup: {
id: 123456,
name: 'review-me',
description: 'vite 쓰고 싶다.',
description: '',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ㅋㅋㅋㅋㅋㅋ

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vite 쓰게 해주세요.

thumnailUrl: '',
},
reviews: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@ import LockToggle from '../LockToggle';
import * as S from './styles';

const PROJECT_IMAGE_SIZE = '6rem';
const DATE_TITLE = '리뷰 작성일';

interface ReviewDescriptionProps extends Omit<ProjectImgProps, '$size'>, Omit<ReviewDateProps, 'dateTitle'> {
isPublic: boolean;
revieweeName: string;
handleClickToggleButton: () => void;
}

const ReviewDescription = ({
thumbnailUrl,
projectName,
revieweeName,
isPublic,
date,
handleClickToggleButton,
Expand All @@ -24,14 +27,19 @@ const ReviewDescription = ({
<S.Description>
<S.DescriptionSide>
<ProjectImg thumbnailUrl={thumbnailUrl} projectName={projectName} $size={PROJECT_IMAGE_SIZE} />
<S.ProjectNameAndDateContainer>
<S.ProjectInfoContainer>
<S.ProjectName>{projectName}</S.ProjectName>
<ReviewDate date={date} dateTitle="리뷰 작성일" />
</S.ProjectNameAndDateContainer>
<S.RevieweeNameAndDateContainer>
<S.RevieweeNameWrapper>
<S.RevieweeName>{revieweeName}</S.RevieweeName>에 대한 리뷰입니다!
</S.RevieweeNameWrapper>
<ReviewDate date={date} dateTitle={DATE_TITLE} />
</S.RevieweeNameAndDateContainer>
</S.ProjectInfoContainer>
</S.DescriptionSide>
<S.DescriptionSide>
{/* 시현 때 숨김 <S.DescriptionSide>
<LockToggle $isPublic={isPublic} handleClickToggleButton={handleClickToggleButton} />
</S.DescriptionSide>
</S.DescriptionSide> */}
</S.Description>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@ export const Description = styled.section`
`;
export const DescriptionSide = styled.div`
display: flex;
width: 100%;
`;
export const ProjectNameAndDateContainer = styled.div`
// 6rem :깃헙 로고 사이즈
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

컨벤션에 있는 내용은 아니긴 한데 이렇게 주석을 달 때 NOTE나 TODO prefix를 사용하는 걸 제안해봅니당

Copy link
Contributor Author

@BadaHertz52 BadaHertz52 Aug 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이것도 컨벤션 회의 때 다뤄보면 좋겠어요.
현재는 NOTE를 추가했어요.

export const ProjectInfoContainer = styled.div`
display: flex;
flex-direction: column;
justify-content: flex-start;

width: calc(100% - 6rem);
margin-left: 1rem;
`;

Expand All @@ -25,3 +29,20 @@ export const ProjectName = styled.p`
font-size: ${({ theme }) => theme.fontSize.medium};
font-weight: ${({ theme }) => theme.fontWeight.bold};
`;

export const RevieweeNameAndDateContainer = styled.div`
display: flex;
align-items: center;
justify-content: space-between;

width: 100%;

font-size: ${({ theme }) => theme.fontSize.basic};
`;

export const RevieweeNameWrapper = styled.p`
margin-top: 0;
`;
export const RevieweeName = styled.span`
color: ${({ theme }) => theme.colors.primary};
`;
Loading