-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[KAN-124] refactor : 마이페이지/작성한 리뷰 페이지 컴포넌트 분리 및 스크롤 그라데이션 효과 추가
- Loading branch information
1 parent
a8e8cd8
commit 346d340
Showing
2 changed files
with
55 additions
and
16 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
src/app/(main)/mypage/review/written/_component/WrittenReviews.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
'use client'; | ||
|
||
import Link from 'next/link'; | ||
import GradientOverlay from '@/app/components/GradientOverlay/GradientOverlay'; | ||
import Review from '@/app/components/Review/Review'; | ||
import useScrollGradientEffect from '@/hooks/useScrollGradientEffect'; | ||
import { ReviewsType } from '@/types/data.type'; | ||
|
||
const WrittenReviews = ({ | ||
writtenReviews, | ||
}: { | ||
writtenReviews: ReviewsType[]; | ||
}) => { | ||
const { | ||
topGradientVisible, | ||
bottomGradientVisible, | ||
firstItemRef: firstReviewRef, | ||
lastItemRef: lastReviewRef, | ||
} = useScrollGradientEffect(); | ||
|
||
return ( | ||
<div className='my-24 flex flex-col gap-24'> | ||
<GradientOverlay position='top' isVisible={topGradientVisible} /> | ||
<GradientOverlay position='bottom' isVisible={bottomGradientVisible} /> | ||
|
||
{writtenReviews.map((review, index) => ( | ||
<div | ||
key={review.id} | ||
ref={ | ||
index === 0 | ||
? firstReviewRef | ||
: index === writtenReviews.length - 1 | ||
? lastReviewRef | ||
: null | ||
} | ||
> | ||
<Link href={`/gatherings/${review.Gathering.id}`}> | ||
<Review | ||
key={review.id} | ||
rating={review.score} | ||
image_source={review.Gathering.image} | ||
description={review.comment} | ||
user_name={review.User.name} | ||
date={review.createdAt} | ||
/> | ||
</Link> | ||
</div> | ||
))} | ||
</div> | ||
); | ||
}; | ||
|
||
export default WrittenReviews; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters