-
Notifications
You must be signed in to change notification settings - Fork 0
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] feat: 리뷰 상세 페이지 구현 #762
Changes from 11 commits
a6812b4
2bc411a
baf67a3
345abbe
69655d6
630c1d0
fba407e
1be4505
2401b6f
2c9dab9
eceaf7a
38b1fe6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,7 +40,7 @@ const rotate = keyframes` | |
} | ||
|
||
100% { | ||
transform: rotate(-360deg); | ||
transform: rotate(360deg); | ||
} | ||
`; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
import { Button, Heading, theme } from '@fun-eat/design-system'; | ||
import { Button, Heading, Link, theme } from '@fun-eat/design-system'; | ||
import { Link as RouterLink } from 'react-router-dom'; | ||
import styled from 'styled-components'; | ||
|
||
import { SvgIcon } from '@/components/Common'; | ||
import { useRoutePage } from '@/hooks/common'; | ||
|
||
interface SectionTitleProps { | ||
name: string; | ||
bookmark?: boolean; | ||
link?: string; | ||
} | ||
Comment on lines
-9
to
+10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
|
||
const SectionTitle = ({ name, bookmark = false }: SectionTitleProps) => { | ||
const SectionTitle = ({ name, link }: SectionTitleProps) => { | ||
const { routeBack } = useRoutePage(); | ||
|
||
return ( | ||
|
@@ -18,18 +19,15 @@ const SectionTitle = ({ name, bookmark = false }: SectionTitleProps) => { | |
<Button type="button" variant="transparent" onClick={routeBack} aria-label="뒤로 가기"> | ||
<SvgIcon variant="arrow" color={theme.colors.gray5} width={15} height={15} /> | ||
</Button> | ||
<Heading size="xl" css="margin-left: 20px"> | ||
{name} | ||
</Heading> | ||
{link ? ( | ||
<Link as={RouterLink} to={link} block> | ||
<ProductName size="xl">{name}</ProductName> | ||
</Link> | ||
) : ( | ||
<ProductName size="xl">{name}</ProductName> | ||
)} | ||
{link && <SvgIcon variant="link" width={20} height={20} />} | ||
</SectionTitleWrapper> | ||
{bookmark && ( | ||
<Button type="button" customWidth="32px" variant="transparent" aria-label="북마크"> | ||
<SvgIcon | ||
variant={bookmark ? 'bookmarkFilled' : 'bookmark'} | ||
color={bookmark ? theme.colors.primary : theme.colors.gray5} | ||
/> | ||
</Button> | ||
)} | ||
</SectionTitleContainer> | ||
); | ||
}; | ||
|
@@ -45,9 +43,12 @@ const SectionTitleContainer = styled.div` | |
const SectionTitleWrapper = styled.div` | ||
display: flex; | ||
align-items: center; | ||
column-gap: 16px; | ||
|
||
svg { | ||
padding-top: 2px; | ||
} | ||
`; | ||
|
||
const ProductName = styled(Heading)` | ||
margin: 0 5px 0 16px; | ||
`; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export { default as useReviewTagsQuery } from './useReviewTagsQuery'; | ||
export { default as useReviewFavoriteMutation } from './useReviewFavoriteMutation'; | ||
export { default as useReviewRegisterFormMutation } from './useReviewRegisterFormMutation'; | ||
export { default as useReviewDetailQuery } from './useReviewDetailQuery'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { useSuspendedQuery } from '../useSuspendedQuery'; | ||
|
||
import { reviewApi } from '@/apis'; | ||
import type { ReviewDetailResponse } from '@/types/response'; | ||
|
||
const fetchReviewDetail = async (reviewId: number) => { | ||
const response = await reviewApi.get({ params: `/${reviewId}` }); | ||
const data: ReviewDetailResponse = await response.json(); | ||
return data; | ||
}; | ||
|
||
const useReviewDetailQuery = (reviewId: number) => { | ||
return useSuspendedQuery(['review'], () => fetchReviewDetail(reviewId)); | ||
}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 여기 쿼리키에 reviewId도 들어가야 할 것 같아요! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 얍! product detail처럼 'detail' key도 추가했습니다~ |
||
|
||
export default useReviewDetailQuery; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"reviews": { | ||
"id": 1, | ||
"userName": "펀잇", | ||
"profileImage": "https://github.com/woowacourse-teams/2023-fun-eat/assets/78616893/1f0fd418-131c-4cf8-b540-112d762b7c34", | ||
"image": "https://i.namu.wiki/i/9wnvUaEa1EkDqG-M0Pbwfdf19FJQQXV_-bnlU2SYaNcG05y2wbabiIrfrGES1M4xSgDjY39RwOvLNggDd3Huuw.webp", | ||
"rating": 4.5, | ||
"tags": [ | ||
{ | ||
"id": 5, | ||
"name": "단짠단짠", | ||
"tagType": "TASTE" | ||
}, | ||
{ | ||
"id": 1, | ||
"name": "망고망고", | ||
"tagType": "TASTE" | ||
} | ||
], | ||
"content": "맛있어용~!~!", | ||
"rebuy": true, | ||
"favoriteCount": 1320, | ||
"favorite": true, | ||
"createdAt": "2023-10-13T00:00:00", | ||
"categoryType": "food", | ||
"productId": 1, | ||
"productName": "칠성 사이다" | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⏰👍