Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
e99d7bf
๐Ÿ› fix: ํ”„๋ฆฌํŒจ์น˜ ๊ธฐ๋Šฅ ๋‹ค์‹œ ์‚ด๋ฆผ
HaeJungg Nov 21, 2024
50f2d61
โœจ feat: ํฌ๋ฃจ ๋ฆฌ๋ทฐ ํƒ€์ž… ์ถ”๊ฐ€
HaeJungg Nov 21, 2024
16d4832
๐Ÿ› fix: ๋ฆฌ๋ทฐ์นด๋“œ ์ˆ˜์ •
HaeJungg Nov 21, 2024
4d15e01
๐Ÿ› fix: ์‚ฌ์šฉํ•˜์ง€ ์•Š๋Š” import ์‚ญ์ œ
HaeJungg Nov 21, 2024
fbf8570
๐Ÿš‘ fix: ํƒ€์ž…์— ๋”ฐ๋ผ ์ด๋ฆ„ ๋ณ€๊ฒฝ
HaeJungg Nov 21, 2024
df2b9de
โœจ feat: ๋ฐ์ดํ„ฐ ํŒจ์น˜
HaeJungg Nov 21, 2024
0dee256
โœจ feat: ๋ ˆ์ด์ง€ ๋กœ๋”ฉ์„ ํ†ตํ•ด ์‹œ๊ฐ„๋‹จ์ถ•
HaeJungg Nov 21, 2024
2591599
โ™ป๏ธ refactor: ํŽ˜์ด์ง€๋„ค์ด์…˜ ๋ฆฌํŒฉํ† ๋ง
HaeJungg Nov 21, 2024
bf23591
๐Ÿ› fix: ์„ ์–ธํ–ˆ์ง€๋งŒ ์‚ฌ์šฉํ•˜์ง€ ์•Š๋Š” ๊ฐ’ ์‚ญ์ œ
HaeJungg Nov 21, 2024
8d67fd4
โœจ feat: ๋ฆฌ๋ทฐ ๋ฆฌ์ŠคํŠธ ์Šค์ผˆ๋ ˆํ†ค UI ์ถ”๊ฐ€
HaeJungg Nov 21, 2024
1997e3c
โœจ feat: ์Šค์ผˆ๋ ˆํ†ค ์‚ฌ์šฉ
HaeJungg Nov 21, 2024
182af6e
โœจ feat: ๋ฐ์ดํ„ฐ ํŒจ์น˜, ์Šค์ผˆ๋ ˆํ†ค ์‚ฌ์šฉ
HaeJungg Nov 21, 2024
8f3cdfb
Merge branch 'develop' into Feat/159/CrewReview
HaeJungg Nov 21, 2024
13c4578
๐Ÿ’„ design: ์Šค์ผˆ๋ ˆํ†ค ๋””์ž์ธ ์ˆ˜์ •
HaeJungg Nov 21, 2024
3abd5bd
๐Ÿ’„ design: ๋ชจ๋ฐ”์ผ ๋””์ž์ธ ์ˆ˜์ •
HaeJungg Nov 21, 2024
e68cfd2
๐Ÿš‘ fix: ๋ฐ์ดํ„ฐ ์ˆ˜์ •
HaeJungg Nov 21, 2024
c54256d
๐Ÿš‘ fix: ํŒจํ‚ค์ง€ ๋ณ€๊ฒฝ
HaeJungg Nov 21, 2024
9e130dc
โœจ feat: ๋ฐ์ดํ„ฐ๊ฐ€ ์—†๋Š”๊ฒฝ์šฐ ์ฒ˜๋ฆฌ
HaeJungg Nov 21, 2024
2d28f3d
๐Ÿ’„ design: ์Šค์ผˆ๋ ˆํ†ค ๋””์ž์ธ ์ˆ˜์ •
HaeJungg Nov 21, 2024
59f5c64
โ™ป๏ธ refactor: ์ฝ”๋“œ ๋ฆฌํŒฉํ† ๋ง
HaeJungg Nov 21, 2024
f61383f
๐Ÿ’„ design: ๋””์ž์ธ์— ๋งž๊ฒŒ ์ˆ˜์ •, ๋ˆ„๋ฝ๋œ ๋ฐ์ดํ„ฐ ์ถ”๊ฐ€, ๋ฐ˜์‘ํ˜• ์ž‘์—…
HaeJungg Nov 21, 2024
0945503
Merge branch 'develop' into Feat/159/CrewReview
HaeJungg Nov 21, 2024
6513988
๐Ÿ› fix: ๋ฐ์ดํ„ฐ๋ช… ๋ณ€๊ฒฝ
HaeJungg Nov 21, 2024
0ebb139
Merge branch 'develop' into Feat/159/CrewReview
HaeJungg Nov 22, 2024
735f463
๐Ÿš‘ fix: ๋งˆ์ดํŽ˜์ด์ง€ 401๋กœ์ง ์ˆ˜์ •
HaeJungg Nov 22, 2024
6de0938
โœจ feat: ๋กœ๊ทธ์ธ์ƒํƒœ๊ฐ€ ์•„๋‹๊ฒฝ์šฐ ๋กœ๊ทธ์ธ ํŽ˜์ด์ง€๋กœ ์ด๋™
HaeJungg Nov 22, 2024
c97c7bf
Merge branch 'develop' into Feat/159/CrewReview
HaeJungg Nov 22, 2024
5a89fe7
๐Ÿ› fix: ์•ˆ์“ฐ๋Š” ์ž„์‹œํŒŒ์ผ ์‚ญ์ œ
HaeJungg Nov 22, 2024
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
120 changes: 0 additions & 120 deletions package-lock.json

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

16 changes: 16 additions & 0 deletions src/_apis/crew/crew-review-apis.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { fetchApi } from '@/src/utils/api';
import { CrewReviewResponse } from '@/src/types/review';

// ํฌ๋ฃจ ๋ฆฌ๋ทฐ ์กฐํšŒ
export async function getCrewReviews(crewId: number, page: number): Promise<CrewReviewResponse> {
const url = `/api/review/${crewId}?page=${page}&size=5`;

const response = await fetchApi<{ data: CrewReviewResponse }>(url, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});

return response.data;
}
9 changes: 9 additions & 0 deletions src/_queries/crew/crew-review-queries.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { useQuery } from '@tanstack/react-query';
import { getCrewReviews } from '@/src/_apis/crew/crew-review-apis';

export function useGetCrewReviewsQuery(crewId: number, page: number) {
return useQuery({
queryKey: ['crewReviews', crewId, page],
queryFn: () => getCrewReviews(crewId, page - 1),
});
}
Comment on lines +4 to +9
Copy link

Choose a reason for hiding this comment

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

๐Ÿ› ๏ธ Refactor suggestion

์ฟผ๋ฆฌ ์„ค์ •์„ ๊ฐœ์„ ํ•ด์ฃผ์„ธ์š”.

ํ˜„์žฌ ๊ตฌํ˜„์—์„œ ๋ช‡ ๊ฐ€์ง€ ๊ฐœ์„ ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค:

  1. page - 1 ๋ณ€ํ™˜์— ๋Œ€ํ•œ ์ฃผ์„ ์„ค๋ช…์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค
  2. ์—๋Ÿฌ ์ฒ˜๋ฆฌ์™€ ์žฌ์‹œ๋„ ๋กœ์ง์ด ๋ˆ„๋ฝ๋˜์—ˆ์Šต๋‹ˆ๋‹ค
  3. ์บ์‹œ ์ „๋žต์ด ์ •์˜๋˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค

๋‹ค์Œ๊ณผ ๊ฐ™์ด ๊ฐœ์„ ํ•ด๋ณด์„ธ์š”:

 export function useGetCrewReviewsQuery(crewId: number, page: number) {
   return useQuery({
     queryKey: ['crewReviews', crewId, page],
-    queryFn: () => getCrewReviews(crewId, page - 1),
+    queryFn: () => getCrewReviews(crewId, page - 1), // API๋Š” 0-based ํŽ˜์ด์ง€๋„ค์ด์…˜์„ ์‚ฌ์šฉ
+    staleTime: 5 * 60 * 1000, // 5๋ถ„
+    retry: 1,
+    onError: (error) => {
+      console.error('ํฌ๋ฃจ ๋ฆฌ๋ทฐ๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๋Š”๋ฐ ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค:', error);
+    },
   });
 }
๐Ÿ“ Committable suggestion

โ€ผ๏ธ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export function useGetCrewReviewsQuery(crewId: number, page: number) {
return useQuery({
queryKey: ['crewReviews', crewId, page],
queryFn: () => getCrewReviews(crewId, page - 1),
});
}
export function useGetCrewReviewsQuery(crewId: number, page: number) {
return useQuery({
queryKey: ['crewReviews', crewId, page],
queryFn: () => getCrewReviews(crewId, page - 1), // API๋Š” 0-based ํŽ˜์ด์ง€๋„ค์ด์…˜์„ ์‚ฌ์šฉ
staleTime: 5 * 60 * 1000, // 5๋ถ„
retry: 1,
onError: (error) => {
console.error('ํฌ๋ฃจ ๋ฆฌ๋ทฐ๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๋Š”๋ฐ ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค:', error);
},
});
}

Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ export default function CreateGathering({ crewId }: { crewId: number }) {

return (
<div className="flex items-center justify-between px-3 md:px-7 lg:px-11">
<div className="flex items-end space-x-2">
<div className="flex flex-col space-y-1 md:flex-row md:items-end md:space-x-2">
<h2 className="text-2xl font-semibold text-gray-800">์•ฝ์† ์žก๊ธฐ</h2>
<span className="text-base font-semibold text-blue-500">
<span className="text-sm font-semibold text-blue-500 md:text-base">
ํ˜„์žฌ {totalGatheringCount}๊ฐœ์˜ ์•ฝ์†์ด ๊ฐœ์„ค๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.
</span>
</div>
Expand Down
20 changes: 9 additions & 11 deletions src/app/(crew)/crew/detail/[id]/_components/crew-review-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import React from 'react';
import { Pagination } from '@mantine/core';
import { cn } from '@/src/utils/cn';
import ReviewCard from '@/src/components/common/review-list/review-card';
import { CrewReview } from '@/src/types/review';

Expand All @@ -21,7 +22,7 @@ export default function CrewReviewList({
return (
<div className="flex flex-col justify-between p-6">
<div className="mb-6 grid flex-grow gap-4">
{/* {reviews.map((review) => (
{reviews.map((review) => (
<ReviewCard
key={review.id}
rate={review.rate}
Expand All @@ -30,30 +31,27 @@ export default function CrewReviewList({
crewId={review.crewId}
reviewer={review.reviewer}
/>
))} */}
))}
</div>
<div className="mt-6 flex justify-center">
<Pagination
total={totalPages}
value={currentPage}
onChange={onPageChange}
classNames={{
control: cn(
'data-[active="true"]:text-blue-500 data-[active="true"]:font-bold',
'border-none bg-transparent hover:bg-transparent',
),
}}
Comment on lines +41 to +46
Copy link

Choose a reason for hiding this comment

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

๐Ÿ› ๏ธ Refactor suggestion

ํŽ˜์ด์ง€๋„ค์ด์…˜ ์ปดํฌ๋„ŒํŠธ์˜ ์ ‘๊ทผ์„ฑ ๊ฐœ์„ ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

ํ˜„์žฌ ์Šคํƒ€์ผ๋ง์€ ๊น”๋”ํ•˜๊ฒŒ ๊ตฌํ˜„๋˜์—ˆ์ง€๋งŒ, ์ ‘๊ทผ์„ฑ ์ธก๋ฉด์—์„œ ๊ฐœ์„ ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

๋‹ค์Œ๊ณผ ๊ฐ™์€ ์ ‘๊ทผ์„ฑ ๊ฐœ์„ ์‚ฌํ•ญ์„ ์ถ”๊ฐ€ํ•ด๋ณด์„ธ์š”:

 classNames={{
   control: cn(
     'data-[active="true"]:text-blue-500 data-[active="true"]:font-bold',
-    'border-none bg-transparent hover:bg-transparent',
+    'border-none bg-transparent hover:bg-transparent focus:ring-2 focus:ring-blue-500',
+    'aria-label="ํŽ˜์ด์ง€ ์ด๋™" role="button"',
   ),
 }}

์ถ”๊ฐ€๋กœ ๋‹ค์Œ ์†์„ฑ๋“ค๋„ Pagination ์ปดํฌ๋„ŒํŠธ์— ์ถ”๊ฐ€ํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค:

 <Pagination
   total={totalPages}
   value={currentPage}
   onChange={onPageChange}
+  aria-label="ํŽ˜์ด์ง€ ๋„ค๋น„๊ฒŒ์ด์…˜"
+  getItemAriaLabel={(page) => `${page}ํŽ˜์ด์ง€๋กœ ์ด๋™`}
   classNames={{

Committable suggestion skipped: line range outside the PR's diff.

styles={{
control: {
border: 'none',
backgroundColor: 'transparent',
'&[data-active]': {
backgroundColor: 'transparent',
fontWeight: 'var(--pagination-active-font-weight)',
color: 'var(--pagination-active-color)',
boxShadow: 'none',
},
'&:hover': {
backgroundColor: 'transparent',
},
},
root: {
'--pagination-active-color': '#3388FF',
'--pagination-active-font-weight': 'bold',
},
}}
size="sm"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ export default function DetailCrew({ id }: DetailCrewContainerProps) {
await refetch();
} catch (joinError) {
if (joinError instanceof ApiError) {
toast.error(joinError.message);
if (joinError.status === 401) {
router.push(`/login?redirect=${encodeURIComponent(window.location.pathname)}`);
} else {
toast.error(joinError.message);
}
Comment on lines +65 to +69
Copy link

Choose a reason for hiding this comment

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

๐Ÿ’ก Codebase verification

401 ์—๋Ÿฌ ์ฒ˜๋ฆฌ๊ฐ€ ์ผ๊ด€๋˜์ง€ ์•Š์€ ๋ถ€๋ถ„์ด ๋ฐœ๊ฒฌ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

handleLeaveCrew์™€ handleConfirmCancel ํ•จ์ˆ˜์—์„œ 401 ์—๋Ÿฌ์— ๋Œ€ํ•œ ์ฒ˜๋ฆฌ๊ฐ€ ๋ˆ„๋ฝ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. ๋‹ค์Œ ์œ„์น˜์—์„œ ์ˆ˜์ •์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค:

  • handleLeaveCrew ํ•จ์ˆ˜์˜ ์—๋Ÿฌ ์ฒ˜๋ฆฌ ๋ถ€๋ถ„์— 401 ์ƒํƒœ ์ฒดํฌ ๋ฐ ๋กœ๊ทธ์ธ ํŽ˜์ด์ง€ ๋ฆฌ๋‹ค์ด๋ ‰์…˜ ์ถ”๊ฐ€ ํ•„์š”
  • handleConfirmCancel ํ•จ์ˆ˜์˜ ์—๋Ÿฌ ์ฒ˜๋ฆฌ ๋ถ€๋ถ„์— 401 ์ƒํƒœ ์ฒดํฌ ๋ฐ ๋กœ๊ทธ์ธ ํŽ˜์ด์ง€ ๋ฆฌ๋‹ค์ด๋ ‰์…˜ ์ถ”๊ฐ€ ํ•„์š”
๐Ÿ”— Analysis chain

401 ์—๋Ÿฌ ์ฒ˜๋ฆฌ ๋กœ์ง์ด ์ ์ ˆํ•˜๊ฒŒ ๊ตฌํ˜„๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

์ธ์ฆ๋˜์ง€ ์•Š์€ ์‚ฌ์šฉ์ž์˜ ํฌ๋ฃจ ์ฐธ์—ฌ ์‹œ๋„๋ฅผ ์ ์ ˆํ•˜๊ฒŒ ์ฒ˜๋ฆฌํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ๋กœ๊ทธ์ธ ํ›„ ์›๋ž˜ ํŽ˜์ด์ง€๋กœ ๋Œ์•„์˜ฌ ์ˆ˜ ์žˆ๋„๋ก redirect ํŒŒ๋ผ๋ฏธํ„ฐ๋ฅผ ํฌํ•จํ•œ ๊ฒƒ์ด ์ข‹์€ UX ๊ตฌํ˜„์ž…๋‹ˆ๋‹ค.

๋‹ค๋งŒ, ๋‹ค์Œ ์‚ฌํ•ญ์„ ํ™•์ธํ•ด ์ฃผ์‹œ๋ฉด ์ข‹๊ฒ ์Šต๋‹ˆ๋‹ค:

  • ๋‹ค๋ฅธ API ํ˜ธ์ถœ ํ•จ์ˆ˜๋“ค(handleLeaveCrew, handleConfirmCancel)์—๋„ ๋™์ผํ•œ 401 ์—๋Ÿฌ ์ฒ˜๋ฆฌ๊ฐ€ ํ•„์š”ํ•œ์ง€ ๊ฒ€ํ† 

์•„๋ž˜ ์Šคํฌ๋ฆฝํŠธ๋กœ ๋‹ค๋ฅธ API ํ˜ธ์ถœ์˜ 401 ์—๋Ÿฌ ์ฒ˜๋ฆฌ ์—ฌ๋ถ€๋ฅผ ํ™•์ธํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค:

๐Ÿ Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if other API calls handle 401 errors consistently

# Search for API call implementations
ast-grep --pattern 'catch (${_}Error) {
  if (${_}Error instanceof ApiError) {
    if (${_}Error.status === 401) {
      $$$
    }
  }
}'

Length of output: 139


Script:

#!/bin/bash
# Search for handleLeaveCrew and handleConfirmCancel functions
ast-grep --pattern 'async function handleLeaveCrew() {
  $$$
}'

ast-grep --pattern 'async function handleConfirmCancel() {
  $$$
}'

# Also search for any error handling patterns in these functions
rg "handleLeaveCrew|handleConfirmCancel" -A 10 -B 10

Length of output: 14725

} else {
toast.error('๐Ÿšซ ํฌ๋ฃจ ์ฐธ์—ฌ ์ค‘ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค.');
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use client';

import { toast } from 'react-toastify';
import { useRouter } from 'next/navigation';
import {
CancelGathering,
JoinGathering,
Expand All @@ -26,16 +27,19 @@ export default function GatheringDetailModalContainer({
const showToast = (message: string, type: 'success' | 'error' | 'warning') => {
toast(message, { type });
};
const router = useRouter();

const handleJoin = async () => {
try {
await JoinGathering(data.crewId, data.id);
showToast('์•ฝ์†์— ์ฐธ์—ฌํ–ˆ์Šต๋‹ˆ๋‹ค.', 'success');
close();
onUpdate?.();
} catch (error) {
if (error instanceof ApiError) {
showToast(`์ฐธ์—ฌ ์ค‘ ์—๋Ÿฌ ๋ฐœ์ƒ: ${error.message}`, 'error');
if (error instanceof ApiError && error.status === 401) {
const redirectUrl = `/login?redirect=${encodeURIComponent(window.location.pathname)}`;
router.push(redirectUrl);
} else {
showToast('์ฐธ์—ฌ ์ค‘ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค.', 'error');
}
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,25 @@ export default function GatheringListSection({ id }: GatheringListSectionProps)
const handleLike = async (gatheringId: number) => {
try {
await addLike(gatheringId);
toast.success('์ฐœํ•˜๊ธฐ๊ฐ€ ์™„๋ฃŒ๋˜์—ˆ์Šต๋‹ˆ๋‹ค!');
} catch (apiError) {
if (apiError instanceof ApiError) {
toast.error(`์ฐœํ•˜๊ธฐ์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค`);
if (apiError instanceof ApiError && apiError.status === 401) {
toast.error('๋กœ๊ทธ์ธ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.');
} else {
toast.error('์ฐœํ•˜๊ธฐ์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค.');
}
}
};

const handleUnlike = async (gatheringId: number) => {
try {
await removeLike(gatheringId);
toast.success('์ฐœํ•˜๊ธฐ ํ•ด์ œ๊ฐ€ ์™„๋ฃŒ๋˜์—ˆ์Šต๋‹ˆ๋‹ค!');
} catch (apiError) {
if (apiError instanceof ApiError) {
toast.error(`์ฐœํ•˜๊ธฐ ํ•ด์ œ์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค`);
if (apiError instanceof ApiError && apiError.status === 401) {
toast.error('๋กœ๊ทธ์ธ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.');
} else {
toast.error('์ฐœํ•˜๊ธฐ ํ•ด์ œ์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค.');
}
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,29 @@ export default {
component: RatingDisplay,
tags: ['autodocs'],
argTypes: {
totalReviewCount: { control: 'number', description: '์ด ํ‰๊ฐ€ ๊ฐœ์ˆ˜' },
totalRate: { control: 'number', description: '์ด ํ‰๊ฐ€ ๊ฐœ์ˆ˜' },
averageRate: { control: 'number', description: 'ํ‰๊ท  ํ‰์ ' },
ratingsData: { control: 'object', description: '๊ฐ ์ ์ˆ˜๋ณ„ ํ‰๊ฐ€ ๊ฐœ์ˆ˜' },
},
} as Meta<typeof RatingDisplay>;

interface RatingDisplayStoryProps {
totalReviewCount: number;
totalRate: number;
averageRate: number;
ratingsData: { score: number; count: number }[];
}

// Template์„ ํ•จ์ˆ˜ ์„ ์–ธ์œผ๋กœ ๋ณ€๊ฒฝํ•˜๊ณ  StoryFn ํƒ€์ž…์„ ์‚ฌ์šฉ
const Template: StoryFn<RatingDisplayStoryProps> = function Template(args) {
const { totalReviewCount, averageRate, ratingsData } = args;
const reviewRateInfo: ReviewRateInfo = { totalReviewCount, averageRate, ratingsData };
const { totalRate, averageRate, ratingsData } = args;
const reviewRateInfo: ReviewRateInfo = { totalRate, averageRate, ratingsData };
return <RatingDisplay reviewRateInfo={reviewRateInfo} />;
};

// ์Šคํ† ๋ฆฌ ์ •์˜
export const Default = Template.bind({});
Default.args = {
totalReviewCount: 24,
totalRate: 24,
averageRate: 3.5,
ratingsData: [
{ score: 5, count: 6 },
Expand All @@ -42,7 +42,7 @@ Default.args = {

export const HighRating = Template.bind({});
HighRating.args = {
totalReviewCount: 15,
totalRate: 15,
averageRate: 4.7,
ratingsData: [
{ score: 5, count: 10 },
Expand All @@ -55,7 +55,7 @@ HighRating.args = {

export const LowRating = Template.bind({});
LowRating.args = {
totalReviewCount: 20,
totalRate: 20,
averageRate: 1.8,
ratingsData: [
{ score: 5, count: 1 },
Expand Down
Loading
Loading