@@ -8,6 +8,65 @@ import {Header} from '@/shared/ui';
8
8
import { CategoryList } from '@/widgets/category-list/ui' ;
9
9
import { CategoryMenu } from '@/widgets/category-list/ui' ;
10
10
import { BottomNavigation , Icon , Typography } from '@wraffle/ui' ;
11
+ import { RaffleCard } from '@wraffle/ui' ;
12
+
13
+ const sampleProducts = [
14
+ {
15
+ id : 2 ,
16
+ name : '럭셔리 시계 경품 래플' ,
17
+ price : 10000 ,
18
+ thumbnailUrl :
19
+ 'https://github.com/user-attachments/assets/4a104905-0106-4b8a-8dcd-06926162e2e6' ,
20
+ scrapCount : 89 ,
21
+ isBookmarked : false ,
22
+ categoryId : 17 ,
23
+ hashtags : [ { id : 8 , name : '사진' } ] ,
24
+ } ,
25
+ {
26
+ id : 3 ,
27
+ name : '최신형 무선 이어버드 래플' ,
28
+ price : 3000 ,
29
+ thumbnailUrl :
30
+ 'https://github.com/user-attachments/assets/4a104905-0106-4b8a-8dcd-06926162e2e6' ,
31
+ scrapCount : 75 ,
32
+ isBookmarked : false ,
33
+ categoryId : 17 ,
34
+ hashtags : [ { id : 50 , name : '엔터테인먼트' } ] ,
35
+ } ,
36
+ {
37
+ id : 4 ,
38
+ name : '다목적 스마트워치 래플' ,
39
+ price : 7000 ,
40
+ thumbnailUrl :
41
+ 'https://github.com/user-attachments/assets/4a104905-0106-4b8a-8dcd-06926162e2e6' ,
42
+ scrapCount : 50 ,
43
+ isBookmarked : false ,
44
+ categoryId : 17 ,
45
+ hashtags : [ { id : 70 , name : '지속가능성' } ] ,
46
+ } ,
47
+ {
48
+ id : 1 ,
49
+ name : '한정판 레트로 스니커즈 래플' ,
50
+ price : 5000 ,
51
+ thumbnailUrl :
52
+ 'https://github.com/user-attachments/assets/4a104905-0106-4b8a-8dcd-06926162e2e6' ,
53
+ scrapCount : 120 ,
54
+ isBookmarked : true ,
55
+ categoryId : 17 ,
56
+ hashtags : [ { id : 34 , name : '웨어러블' } ] ,
57
+ } ,
58
+ {
59
+ id : 5 ,
60
+ name : '에코 전동 스쿠터 래플' ,
61
+ price : 15000 ,
62
+ thumbnailUrl :
63
+ 'https://github.com/user-attachments/assets/4a104905-0106-4b8a-8dcd-06926162e2e6' ,
64
+ scrapCount : 65 ,
65
+ isBookmarked : false ,
66
+ categoryId : 17 ,
67
+ hashtags : [ { id : 63 , name : '친환경' } ] ,
68
+ } ,
69
+ ] ;
11
70
12
71
const CategoryPage = ( ) => {
13
72
const searchParams = useSearchParams ( ) ;
@@ -26,6 +85,12 @@ const CategoryPage = () => {
26
85
? categories . filter ( category => category . parentId === currentCategory ?. id ) // 하위 카테고리 필터링
27
86
: categories . filter ( category => category . parentId === null ) ; // 상위 카테고리 필터링
28
87
88
+ const filteredProducts = selectedCategory
89
+ ? sampleProducts . filter (
90
+ sampleProducts => sampleProducts . categoryId === selectedCategory ,
91
+ )
92
+ : [ ] ;
93
+
29
94
const handleSelectCategory = ( category : CategoryItem ) => {
30
95
setSelectedCategory ( category . id ) ; // 선택된 카테고리 상태만 업데이트
31
96
} ;
@@ -46,18 +111,51 @@ const CategoryPage = () => {
46
111
</ Header . Right >
47
112
</ Header >
48
113
{ currentCategory ? (
49
- < section className = 'mb-4 flex justify-center' >
114
+ < section className = 'flex flex-col justify-center' >
115
+ < Header withUnderline >
116
+ < Header . Middle >
117
+ < Typography size = 'h4' > { currentCategory . name } </ Typography >
118
+ </ Header . Middle >
119
+ </ Header >
50
120
< CategoryMenu
51
121
categories = { filteredCategories }
52
122
selectedCategory = { selectedCategory }
53
123
onSelectCategory = { handleSelectCategory }
54
124
/>
55
125
</ section >
56
126
) : (
57
- < section className = 'mb-4 flex justify-center' >
127
+ < section className = 'flex justify-center' >
58
128
< CategoryList categories = { filteredCategories } />
59
129
</ section >
60
130
) }
131
+ { selectedCategory && (
132
+ < section className = 'p-4' >
133
+ < div
134
+ className = 'grid justify-center gap-[20px]'
135
+ style = { {
136
+ gridTemplateColumns : 'repeat(auto-fit, 160px)' ,
137
+ } }
138
+ >
139
+ { filteredProducts . length > 0 ? (
140
+ filteredProducts . map ( product => (
141
+ < RaffleCard
142
+ key = { product . id }
143
+ name = { product . name }
144
+ thumbnailUrl = { product . thumbnailUrl }
145
+ price = { product . price . toString ( ) }
146
+ scrapCount = { product . scrapCount }
147
+ isBookmarked = { product . isBookmarked }
148
+ hashtags = { product . hashtags }
149
+ />
150
+ ) )
151
+ ) : (
152
+ < Typography size = 'h5' className = 'text-gray-500' >
153
+ 상품 추가 예정입니다.
154
+ </ Typography >
155
+ ) }
156
+ </ div >
157
+ </ section >
158
+ ) }
61
159
< BottomNavigation />
62
160
</ div >
63
161
) ;
0 commit comments