diff --git a/src/components/common/card/ReviewCard.tsx b/src/components/common/card/ReviewCard.tsx index b3dd76c..35ee003 100644 --- a/src/components/common/card/ReviewCard.tsx +++ b/src/components/common/card/ReviewCard.tsx @@ -33,7 +33,7 @@ export function ReviewCard({ children }: ReviewCardProps) { ReviewCard.UserHeader = function UserHeader({ userIcon, reviewId, children }: UserHeaderProps) { const username = useReviewCardStore((state) => state.allReviews[reviewId]?.user.nickname); const userImg = useReviewCardStore((state) => state.allReviews[reviewId]?.user.image); - const timeAgo = useReviewCardStore((state) => state.allReviews[reviewId]?.updatedAt); + const timeAgo = useReviewCardStore((state) => state.allReviews[reviewId]?.createdAt); return (
diff --git a/src/components/wineDetail/WineRating.tsx b/src/components/wineDetail/WineRating.tsx index 0f8ff69..b32ee03 100644 --- a/src/components/wineDetail/WineRating.tsx +++ b/src/components/wineDetail/WineRating.tsx @@ -1,5 +1,7 @@ import React from 'react'; +import { motion } from 'framer-motion'; + import { Progress } from '@/components/ui/progress'; import useWineStore from '@/stores/wineStore'; @@ -18,8 +20,16 @@ function WineRating({ rating, reviewCount, ratings }: Props) { if (!nowWine) return; const { id, name } = nowWine; + const percentageArr = [...ratings].reverse().map((rating) => { + return (rating / reviewCount) * 100; + }); + return ( -
@@ -40,7 +50,7 @@ function WineRating({ rating, reviewCount, ratings }: Props) {
- {[...ratings].reverse().map((rating, i) => ( + {percentageArr.map((rating, i) => (
{5 - i}점 @@ -49,7 +59,7 @@ function WineRating({ rating, reviewCount, ratings }: Props) {
)} -
+ ); } diff --git a/src/pages/wines/[wineid].tsx b/src/pages/wines/[wineid].tsx index f86e081..73df9a9 100644 --- a/src/pages/wines/[wineid].tsx +++ b/src/pages/wines/[wineid].tsx @@ -2,6 +2,7 @@ import React, { useEffect } from 'react'; import { dehydrate, QueryClient, useQuery } from '@tanstack/react-query'; import axios from 'axios'; +import { motion } from 'framer-motion'; import { GetServerSideProps } from 'next'; import dynamic from 'next/dynamic'; import Head from 'next/head'; @@ -64,27 +65,45 @@ export default function WineInfoById(props: WinePageProps) {
- - - + + + + +
-

리뷰 목록

- + +

+ 리뷰 목록 +

+ +
+ + />