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

feat: 리뷰 컴포넌트 UI 작성 #24

Merged
merged 5 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added public/images/mock-image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
76 changes: 76 additions & 0 deletions src/app/components/Review/Review.tsx
Copy link
Contributor

Choose a reason for hiding this comment

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

받아오는 Props가 복잡한데 잘 작성해주셨어요!
LGTM!

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
Copy link
Contributor

Choose a reason for hiding this comment

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

P4) 위에 두 개도 옵셔널 체이닝 하시면 어떠신가요?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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'
}`}
/>
))}
Copy link
Contributor

Choose a reason for hiding this comment

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

5-rating 을 lengh로 줘서 빈하트 배열만 추가해주시면 좋을 것 같습니다!

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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]'>
Copy link
Contributor

Choose a reason for hiding this comment

The 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>
Copy link
Contributor

Choose a reason for hiding this comment

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

text-[12px] 의 경우 , tailwind config 수정해서 text-12 로 (제 PR 머지 되면) 사용 가능해요!

</div>
</div>
<div className='pl-[12px] text-[12px] text-var-gray-500'>{date}</div>
</div>
</div>
</div>
);
};

export default Review;
Loading