diff --git a/src/pages/main/components/review/index.tsx b/src/pages/main/components/review/index.tsx index e68d6a2..021cdaf 100644 --- a/src/pages/main/components/review/index.tsx +++ b/src/pages/main/components/review/index.tsx @@ -1,9 +1,25 @@ +import { useGetRecentlyReview } from '@/apis/recently-review/getRecentlyReview.api'; import StarIcon from '@/assets/main/Star-Icon.svg'; import ProfileIcon from '@/assets/main/ZZAN-Profile.png'; -import { Box, Image, Text } from '@chakra-ui/react'; +import { Box, Image, Text, Spinner } from '@chakra-ui/react'; import styled from '@emotion/styled'; const Review = () => { + const { data, isLoading } = useGetRecentlyReview(0, 10); + + if (isLoading) { + return ( + + + + ); + } + return ( <> { 최근 챌린지 리뷰 - + {!data || data?.data.length === 0 ? ( - 쓰레기 줍기 챌린지 + 최근 챌린지 리뷰가 존재하지 않아요.. - - - - - - - - - 짠돌이 - - - - - 세상이 깨끗해지는 기분이에요! 포인트도 많이줘서 등급 올리기 ... - - - + ) : ( + data?.data.map((review) => ( + + + {review.challengeTitle} + + + {Array.from({ length: review.rating }, (_, index) => ( + + ))} + + + + + {review.user.nickname} + + + + + {review.content} + + + + )) + )} ); @@ -69,19 +95,29 @@ const Container = styled(Box)` `; const ReviewLayout = styled(Container)` - height: 15.5625rem; - padding: 0.9375rem 4.8125rem 0.9375rem 0.8125rem; + display: flex; + overflow-x: scroll; + height: 15.5rem; + padding: 0.9375rem 0.8125rem; margin: 1rem; border-radius: 1.25rem; - background: var(--green--06, rgba(240, 244, 243, 0.75)); + background: var(--color-green-06); box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25); + + &::-webkit-scrollbar { + display: none; + } `; const ChallengeLayout = styled.div` + flex-shrink: 0; + display: flex; + flex-direction: column; width: 18rem; height: 13.7rem; padding: 1rem; + margin-right: 1rem; border-radius: 1.25rem; background-color: var(--color-green-01); box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25); @@ -99,5 +135,13 @@ const ReviewProfileContainer = styled(Container)` flex-direction: row; justify-content: space-between; width: 5.5rem; - gap: 0.25rem; +`; + +const ImageBox = styled(Image)` + display: flex; + width: 2rem; + justify-content: center; + align-items: center; + border-radius: 50%; + box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25); `;