Skip to content

Commit

Permalink
refactor: ReviewSummary에서 글쓴이 정보 받도록 ReviewList와 ReviewSummary 프롭 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
grapefruit13 committed Apr 1, 2024
1 parent a886491 commit 22330db
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/components/postDetail/ReviewList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ const cx = classNames.bind(styles);

type ReviewListProps = {
list: ReviewResponse;
profileImageUrl: string;
nickname: string;
email: string;
};

const ReviewList = ({ list, nickname, email }: ReviewListProps) => {
const ReviewList = ({ list, profileImageUrl, nickname, email }: ReviewListProps) => {
const [page, setPage] = useState(1);

const currentDeviceType = useDeviceType();
Expand Down Expand Up @@ -72,7 +73,7 @@ const ReviewList = ({ list, nickname, email }: ReviewListProps) => {
<Dropdown options={REVIEW_SORT_OPTIONS} onChange={handleOptionChange} isSmall color='yellow' />
</div>
</div>
<ReviewSummary rating={averageRating} nickname={nickname} email={email} />
<ReviewSummary profileImageUrl={profileImageUrl} nickname={nickname} email={email} rating={averageRating} />
</header>
<div className={cx('review-list-review-group')}>
<ul className={cx('item-list')}>
Expand Down
8 changes: 4 additions & 4 deletions src/components/postDetail/ReviewSummary/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ import { toFixedOneDecimal } from '@/utils';

import Avatar from '@/components/commons/Avatar';
import StarRating from '@/components/commons/StarRating';
import { USER_DATA } from '@/constants/mockData/headerMockData';

import styles from './ReviewSummary.module.scss';

const cx = classNames.bind(styles);

type ReviewSummary = {
type ReviewSummaryProps = {
profileImageUrl: string;
rating: number;
nickname: string;
email: string;
};

const ReviewSummary = ({ rating, nickname, email }: ReviewSummary) => {
const ReviewSummary = ({ profileImageUrl, nickname, email, rating }: ReviewSummaryProps) => {
return (
<div className={cx('review-summary')}>
<div className={cx('review-summary-profile')}>
<Avatar size='medium' profileImageUrl={USER_DATA.profileImageUrl} />
<Avatar size='medium' profileImageUrl={profileImageUrl} />
<div className={cx('review-summary-profile-info')}>
<span className={cx('nickname')}>{nickname}</span>
<span className={cx('email')}>{email}</span>
Expand Down

0 comments on commit 22330db

Please sign in to comment.