@@ -8,6 +8,7 @@ import Dropdown from '@components/Dropdown';
88import Pagination from '@components/Pagination' ;
99import CategoryFilter from '@/app/(with-header)/components/CategoryFilter' ;
1010import ExperienceCard from '@/app/(with-header)/components/ExperienceCard' ;
11+ import ExperienceCardSkeleton from '@/app/(with-header)/components/Skeletons/ExperienceCardSkeleton' ;
1112import { getExperiences , ExperienceListResult } from '@/app/api/experiences/getExperiences' ;
1213import { ACTIVITY_CATEGORIES , ActivityCategory } from '@/constants/categories' ;
1314import {
@@ -26,15 +27,14 @@ export default function ExperienceList({ keyword, isSearchMode }: ExperienceList
2627 const [ selectedCategory , setSelectedCategory ] = useState < ActivityCategory > ( ACTIVITY_CATEGORIES [ 0 ] ) ;
2728 const [ sortOption , setSortOption ] = useState < string | undefined > ( '' ) ;
2829
29- // TanStack Query 사용 (타입 명시 필수)
30- const { data, isLoading, error } = useQuery < ExperienceListResult > ( {
30+ const { data, isLoading } = useQuery < ExperienceListResult > ( {
3131 queryKey : [ 'experiences' , currentPage , selectedCategory , sortOption , keyword ] ,
3232 queryFn : ( ) =>
3333 getExperiences ( {
3434 page : currentPage ,
3535 sort : sortOption ,
3636 category : selectedCategory ,
37- keyword,
37+ keyword : keyword || undefined ,
3838 } ) ,
3939 placeholderData : ( prev ) => prev ,
4040 } ) ;
@@ -44,7 +44,8 @@ export default function ExperienceList({ keyword, isSearchMode }: ExperienceList
4444 const totalPage = Math . ceil ( totalCount / 8 ) ;
4545
4646 return (
47- < section className = 'max-w-1200 m-auto px-24 md:px-0 pb-83' >
47+ < section className = 'max-w-1200 m-auto px-24 lg:px-0 pb-83' >
48+ { /* 🔍 검색 모드일 때 문구 표시 */ }
4849 { isSearchMode && keyword && (
4950 < >
5051 < p className = "text-left text-lg font-semibold ml-4 md:ml-0 mt-32" >
@@ -53,7 +54,7 @@ export default function ExperienceList({ keyword, isSearchMode }: ExperienceList
5354 < p className = "text-left text-sm font-normal ml-4 md:ml-0 mt-8 mb-16" >
5455 총 < span className = "font-semibold" > { totalCount } </ span > 개의 결과
5556 </ p >
56- { experiences . length === 0 && (
57+ { experiences . length === 0 && ! isLoading && (
5758 < p className = "text-center text-gray-500 mt-32" > 검색 결과가 없습니다.</ p >
5859 ) }
5960 </ >
@@ -87,13 +88,12 @@ export default function ExperienceList({ keyword, isSearchMode }: ExperienceList
8788 < h2 className = 'text-xl md:text-3xl font-bold' > 🛼 모든 체험</ h2 >
8889 ) }
8990
90- { isLoading ? (
91- < p className = "text-center" > 체험을 불러오는 중입니다...</ p >
92- ) : error ? (
93- < p className = "text-center text-red-500" > 체험 데이터를 불러오는 데 실패했습니다 😢</ p >
94- ) : (
95- < div className = 'grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-8 md:gap-16 lg:gap-24 mt-24' >
96- { experiences . map ( ( exp ) => (
91+ { /* 체험 카드 목록 */ }
92+ < div className = 'grid grid-cols-2 grid-rows-2 md:grid-cols-3 md:grid-rows-3 lg:grid-cols-4 lg:grid-rows-2 gap-8 md:gap-16 lg:gap-24 mt-24' >
93+ { isLoading ? (
94+ Array . from ( { length : 8 } ) . map ( ( _ , idx ) => < ExperienceCardSkeleton key = { idx } /> )
95+ ) : (
96+ experiences . map ( ( exp ) => (
9797 < Link key = { exp . id } href = { `/activities/${ exp . id } ` } >
9898 < ExperienceCard
9999 imageUrl = { exp . bannerImageUrl }
@@ -103,9 +103,9 @@ export default function ExperienceList({ keyword, isSearchMode }: ExperienceList
103103 title = { exp . title }
104104 />
105105 </ Link >
106- ) ) }
107- </ div >
108- ) }
106+ ) )
107+ ) }
108+ </ div >
109109 </ div >
110110
111111 { experiences . length > 0 && (
0 commit comments