@@ -16,6 +16,7 @@ import {ProductType} from '@/types/ProductType';
16
16
import { useNavigation } from '@react-navigation/native' ;
17
17
import { StackNavigationProp } from '@react-navigation/stack' ;
18
18
import { RootStackParamList } from '@/types/StackNavigationType' ;
19
+ import SubscribeIcon from '@/components/common/SubscribeIcon' ;
19
20
import { BottomButton } from '@/components/common' ;
20
21
type CartItem = {
21
22
productId : number ;
@@ -28,7 +29,9 @@ const MarketDetailPage = ({
28
29
pickupEndAt,
29
30
address,
30
31
products,
31
- } : Omit < MarketType , 'id' | 'images' > ) => {
32
+ hasLike,
33
+ id,
34
+ } : Omit < MarketType , 'images' > ) => {
32
35
const navigation = useNavigation < StackNavigationProp < RootStackParamList > > ( ) ;
33
36
const [ cart , setCart ] = useState < CartItem [ ] > ( [ ] ) ;
34
37
const [ selectedTag , setSelectedTag ] = useState < string > ( '추천메뉴' ) ;
@@ -41,6 +44,7 @@ const MarketDetailPage = ({
41
44
{ } ,
42
45
) ;
43
46
const [ tagWidths , setTagWidths ] = useState < { [ key : string ] : number } > ( { } ) ;
47
+ const [ marketIsLiked , setMarketIsLiked ] = useState < boolean > ( hasLike ) ;
44
48
const scrollTimeoutRef = useRef < NodeJS . Timeout | null > ( null ) ;
45
49
const handleCountChange = ( productId : number , newCount : number ) => {
46
50
handleCart (
@@ -202,6 +206,9 @@ const MarketDetailPage = ({
202
206
scrollToSection ( tag ) ;
203
207
} ;
204
208
209
+ const handleSubscribe = ( ) => {
210
+ setMarketIsLiked ( prevState => ! prevState ) ;
211
+ } ;
205
212
const navigatePage = ( ) => {
206
213
if ( cart . length === 0 ) {
207
214
Alert . alert ( '장바구니가 비어 있습니다.' ) ;
@@ -245,6 +252,13 @@ const MarketDetailPage = ({
245
252
) } ~ ${ format ( pickupEndAt , 'HH시 mm분' ) } `} </ S . MarketSideInfo >
246
253
< S . MarketSideInfo > { address } </ S . MarketSideInfo >
247
254
</ S . MarketSideInfoWrapper >
255
+ < View >
256
+ < SubscribeIcon
257
+ marketIsLiked = { marketIsLiked }
258
+ marketId = { id }
259
+ handleSubscribe = { handleSubscribe }
260
+ />
261
+ </ View >
248
262
< S . SideTagBarScrollView
249
263
horizontal
250
264
showsHorizontalScrollIndicator = { false }
0 commit comments