-
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
feat: 리뷰 컴포넌트 UI 작성 #24
Changes from all commits
2d66447
a8ea624
2c14d1e
2935e92
eda170a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import Image from 'next/image'; | ||
|
||
import { IconHeart } from '@/public/icons'; | ||
import { Profile } from '@/public/images'; | ||
|
||
interface ReviewProps { | ||
image_source?: string; | ||
rating: number; | ||
description: string; | ||
Comment on lines
+8
to
+9
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. P4) 위에 두 개도 옵셔널 체이닝 하시면 어떠신가요? 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. rating, description 은 리뷰 컴포넌트에서 계속 사용되는 것 같아서 이렇게 지정했습니다...! |
||
place?: string; | ||
location?: string; | ||
user_name: string; | ||
date: string; | ||
} | ||
|
||
const TOTAL_RATING = 5; | ||
|
||
const Review = ({ | ||
image_source, | ||
rating, | ||
description, | ||
place, | ||
location, | ||
user_name, | ||
date, | ||
}: ReviewProps) => { | ||
return ( | ||
<div className='flex-col space-x-6 p-[10px] font-medium md:flex md:flex-row'> | ||
{image_source ? ( | ||
<div className='relative h-[252px] w-full md:h-auto md:w-[378px]'> | ||
<Image | ||
className='rounded-[20px] object-cover' | ||
src={image_source} | ||
alt='review image' | ||
fill | ||
quality={85} | ||
sizes='(max-width: 768px) 100vw, 378px' | ||
/> | ||
</div> | ||
) : null} | ||
|
||
<div> | ||
<div className='mt-[10px] flex md:mt-0'> | ||
{Array.from({ length: TOTAL_RATING }).map((_, index) => ( | ||
<IconHeart | ||
key={index} | ||
className={`h-24 w-24 ${ | ||
index < rating ? 'text-var-orange-600' : 'text-gray-200' | ||
}`} | ||
/> | ||
))} | ||
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. 5-rating 을 lengh로 줘서 빈하트 배열만 추가해주시면 좋을 것 같습니다! 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. 넵 추가했습니다...! |
||
</div> | ||
|
||
<div className='mt-[10px] text-[14px] text-black'> | ||
<div>{description}</div> | ||
</div> | ||
|
||
<div className='mt-[10px] text-var-gray-700'> | ||
{place} 이용 · {location} | ||
</div> | ||
|
||
<div className='mt-8 flex items-center space-x-[8px] divide-x divide-var-gray-700 md:mt-10'> | ||
<div> | ||
<div className='flex items-center space-x-[8px]'> | ||
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. space 속성 배워갑니다 👏 |
||
<Profile className='h-24 w-24' /> | ||
<div className='text-[12px] text-var-gray-700'>{user_name}</div> | ||
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.
|
||
</div> | ||
</div> | ||
<div className='pl-[12px] text-[12px] text-var-gray-500'>{date}</div> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Review; |
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.
받아오는 Props가 복잡한데 잘 작성해주셨어요!
LGTM!