From e3fe458271783e85084209d7fce0dca38769ebea Mon Sep 17 00:00:00 2001 From: SJ-Kwak Date: Wed, 31 Jan 2024 21:27:24 +0900 Subject: [PATCH] sdp-tech#11 feat: add product & service view all options --- src/assets/common/Pencil.svg | 3 + src/common/BottomButton.tsx | 6 +- src/common/Footer.tsx | 4 +- src/components/Home/Market/MarketTabView.tsx | 12 +++ src/components/Home/Market/ProductPage.tsx | 79 ++++++++++++------- src/components/Home/components/ReviewItem.tsx | 6 +- .../Home/components/ServiceItem.tsx | 2 +- 7 files changed, 75 insertions(+), 37 deletions(-) create mode 100644 src/assets/common/Pencil.svg diff --git a/src/assets/common/Pencil.svg b/src/assets/common/Pencil.svg new file mode 100644 index 0000000..4d77ec7 --- /dev/null +++ b/src/assets/common/Pencil.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/common/BottomButton.tsx b/src/common/BottomButton.tsx index 585f801..fcb14b1 100644 --- a/src/common/BottomButton.tsx +++ b/src/common/BottomButton.tsx @@ -2,7 +2,7 @@ import { useState } from 'react'; import { View, TouchableOpacity } from 'react-native'; import styled from 'styled-components/native'; import { Body16M } from '../styles/GlobalText'; -import { PURPLE, GREEN } from '../styles/GlobalColor'; +import { PURPLE, GREEN, PURPLE2 } from '../styles/GlobalColor'; interface BottomButtonProps { value: string; @@ -13,7 +13,7 @@ interface BottomButtonProps { const BottomButton = ({ value, pressed, onPress }: BottomButtonProps) => { return ( - {value} + {value} ) } @@ -24,7 +24,7 @@ const ButtonContainer = styled.TouchableOpacity<{ pressed: boolean }>` justify-content: center; border-radius: 8px; padding: 10px 90px; - background-color: ${(props: { pressed: boolean; }) => props.pressed ? GREEN : PURPLE}; + background-color: ${(props: { pressed: boolean; }) => props.pressed ? PURPLE : GREEN}; ` export default BottomButton; \ No newline at end of file diff --git a/src/common/Footer.tsx b/src/common/Footer.tsx index ab46de3..45aa1ec 100644 --- a/src/common/Footer.tsx +++ b/src/common/Footer.tsx @@ -9,8 +9,8 @@ const Footer = () => { const [pressed, setPressed] = useState(false); return ( - setLike(!like)} blank /> - setPressed(!pressed)} /> + {setLike(!like)}} blank /> + {}} /> ) } diff --git a/src/components/Home/Market/MarketTabView.tsx b/src/components/Home/Market/MarketTabView.tsx index 0f1956f..6c397c8 100644 --- a/src/components/Home/Market/MarketTabView.tsx +++ b/src/components/Home/Market/MarketTabView.tsx @@ -17,6 +17,7 @@ import Hashtag from '../../../common/Hashtag.tsx'; import Footer from '../../../common/Footer.tsx'; import Arrow from '../../../assets/common/Arrow.svg'; +import Pencil from '../../../assets/common/Pencil.svg'; const ProfileSection = ({ navigation }: {navigation: any}) => { const filter = ['스포티', '영캐주얼', '깔끔'] @@ -25,6 +26,9 @@ const ProfileSection = ({ navigation }: {navigation: any}) => { navigation.goBack()}> + + + { + const [service, setService] = useState(false); + const [product, setProduct] = useState(false); + // 한 줄에 2개씩 상품 아이템 배치 - const product = [...new Array(6).keys()] + const items = [...new Array(6).keys()] const splitArrayIntoPairs = (arr: any[], pairSize: number) => { return arr.reduce((result, item, index) => { if (index % pairSize === 0) { @@ -23,42 +26,62 @@ const ProductPage = () => { return result; }, []); }; - const splitProduct = splitArrayIntoPairs(product, 2); + const splitItems = splitArrayIntoPairs(items, 2); return ( - - + + setService(!service)}> 리폼러의 서비스 - + { !service && } - { - return ( - {}} /> - ) - }} - slider - /> + { service ? + + {items.map((item, index) => ( + {}} /> + ))} + + : + { + return ( + {}} /> + ) + }} + slider + /> + } - + setProduct(!product)}> 리폼러의 판매상품 - + { !product && } - { - return ( - - {item.map((subItem: any) => ( - {}} /> + { product ? + + {splitItems.map((row: any[], rowIndex: number) => ( + + {row.map((item, columnIndex) => ( + {}} /> ))} - ) - }} - dot - /> + ))} + + : + { + return ( + + {item.map((subItem: any) => ( + {}} /> + ))} + + ) + }} + slider + /> + } ) diff --git a/src/components/Home/components/ReviewItem.tsx b/src/components/Home/components/ReviewItem.tsx index 3dd6146..8d3044b 100644 --- a/src/components/Home/components/ReviewItem.tsx +++ b/src/components/Home/components/ReviewItem.tsx @@ -12,7 +12,7 @@ interface ReviewItemProps { const ReviewItem = ({ onPress }: ReviewItemProps) => { // 한 줄에 2개씩 아이템 배치 - const product = [...new Array(6).keys()] + const items = [...new Array(6).keys()] const splitArrayIntoPairs = (arr: any[], pairSize: number) => { return arr.reduce((result, item, index) => { if (index % pairSize === 0) { @@ -22,7 +22,7 @@ const ReviewItem = ({ onPress }: ReviewItemProps) => { return result; }, []); }; - const splitProduct = splitArrayIntoPairs(product, 2); + const splitItems = splitArrayIntoPairs(items, 2); return ( @@ -36,7 +36,7 @@ const ReviewItem = ({ onPress }: ReviewItemProps) => { { return ( diff --git a/src/components/Home/components/ServiceItem.tsx b/src/components/Home/components/ServiceItem.tsx index 3e025fe..74de178 100644 --- a/src/components/Home/components/ServiceItem.tsx +++ b/src/components/Home/components/ServiceItem.tsx @@ -13,7 +13,7 @@ interface ServiceItemProps { const ServiceItem = ({ onPress }: ServiceItemProps) => { const [like, setLike] = useState(false); return ( - +