forked from sdp-tech/UPCY_Mobile
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sdp-tech#11 feat: add market review page
* sdp-tech#11 feat: add review item * sdp-tech#11 feat: add market review page
- Loading branch information
Showing
12 changed files
with
270 additions
and
19 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { useState } from 'react'; | ||
import { View, FlatList, TouchableOpacity } from 'react-native'; | ||
import StarIcon from '../assets/common/Star.svg'; | ||
import { LIGHTGRAY, PURPLE } from '../styles/GlobalColor'; | ||
|
||
interface StarProps { | ||
index: number; | ||
pressed: boolean; | ||
onPress: (index: number) => void; | ||
} | ||
|
||
const Star = ({ index, pressed, onPress }: StarProps) => { | ||
return ( | ||
<TouchableOpacity onPress={() => onPress(index)}> | ||
<StarIcon color={pressed ? PURPLE : LIGHTGRAY} /> | ||
</TouchableOpacity> | ||
); | ||
}; | ||
|
||
const StarRating = () => { | ||
const [rating, setRating] = useState<number>(0); | ||
|
||
return ( | ||
<FlatList | ||
horizontal | ||
scrollEnabled={false} | ||
data={[...new Array(5).keys()]} | ||
renderItem={({ item, index }) => ( | ||
<Star index={index} pressed={index < rating} onPress={() => setRating(index+1)} /> | ||
)} | ||
keyExtractor={(item, index) => index.toString()} | ||
/> | ||
); | ||
}; | ||
|
||
export default StarRating; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { View, Text } from 'react-native'; | ||
import { Tabs } from 'react-native-collapsible-tab-view'; | ||
import styled from 'styled-components/native'; | ||
import StarRating from '../../../common/StarRating'; | ||
import ReviewComment from '../components/ReviewComment'; | ||
import ReviewItem from '../components/ReviewItem'; | ||
import { Body14B, Caption11M } from '../../../styles/GlobalText'; | ||
import { BLACK, LIGHTGRAY } from '../../../styles/GlobalColor'; | ||
import ReviewSummary from '../components/ReviewSummary'; | ||
import Slider from '../../../common/Slider'; | ||
|
||
const SummarySection = () => { | ||
|
||
|
||
return ( | ||
<View style={{paddingVertical: 20, paddingHorizontal: 40, borderBottomColor: LIGHTGRAY, borderBottomWidth: 1}}> | ||
<ItemContainer style={{marginBottom: 20}}> | ||
<View style={{alignItems: 'center', justifyContent: 'center', paddingVertical: 15}}> | ||
<Text style={{color: BLACK, fontSize: 40, fontWeight: '700'}}>4.0</Text> | ||
<StarRating /> | ||
</View> | ||
<View style={{paddingHorizontal: 40, flex: 1}}> | ||
{[1, 2, 3, 4, 5].map((idx) => { | ||
return ( | ||
<ItemContainer style={{alignItems: 'center'}}> | ||
<Caption11M style={{marginRight: 5}}>{idx}점</Caption11M> | ||
<Slider total={20} page={3} rating /> | ||
<Caption11M style={{marginLeft: 5}}>3</Caption11M> | ||
</ItemContainer> | ||
); | ||
})} | ||
</View> | ||
</ItemContainer> | ||
<ItemContainer> | ||
<Body14B>거래</Body14B> | ||
<ReviewComment value='상담이 친절해요' /> | ||
<ReviewComment value='약속을 잘 지켜요' /> | ||
</ItemContainer> | ||
<ItemContainer> | ||
<Body14B>디자인</Body14B> | ||
<ReviewComment value='마무리가 꼼꼼해요' /> | ||
<ReviewComment value='트렌디해요' /> | ||
</ItemContainer> | ||
</View> | ||
) | ||
} | ||
|
||
const ItemContainer = styled.View` | ||
display: flex; | ||
flex-direction: row; | ||
padding: 5px; | ||
` | ||
|
||
const ReviewPage = () => { | ||
|
||
return ( | ||
<Tabs.FlatList | ||
data={[...new Array(3).keys()]} | ||
ListHeaderComponent={SummarySection} | ||
renderItem={({item}:any) => { | ||
return ( | ||
<ReviewItem onPress={() => {}} /> | ||
) | ||
}} | ||
keyExtractor={(item, index) => index.toString()} | ||
style={{marginBottom: 60}} | ||
/> | ||
) | ||
} | ||
|
||
export default ReviewPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import styled from 'styled-components/native'; | ||
import { GREEN } from '../../../styles/GlobalColor'; | ||
import { Caption11M } from '../../../styles/GlobalText'; | ||
|
||
interface ReviewCommentProps { | ||
value: string; | ||
} | ||
|
||
const ReviewComment = ({ value }: ReviewCommentProps) => { | ||
return ( | ||
<ReviewContainer> | ||
<Caption11M>{value}</Caption11M> | ||
</ReviewContainer> | ||
) | ||
} | ||
|
||
const ReviewContainer = styled.View` | ||
display: flex; | ||
padding: 5px 12px; | ||
margin: 0px 5px; | ||
justify-content: center; | ||
align-items: center; | ||
border-radius: 12px; | ||
background: ${GREEN}; | ||
` | ||
|
||
export default ReviewComment; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import { View, Image, ImageBackground } from 'react-native'; | ||
import Carousel from '../../../common/Carousel'; | ||
import StarRating from '../../../common/StarRating'; | ||
import ReviewComment from './ReviewComment'; | ||
import { BLACK2, GRAY, LIGHTGRAY } from '../../../styles/GlobalColor'; | ||
import styled from 'styled-components/native'; | ||
import { Body14B, Body14R, Body16M, Caption11M } from '../../../styles/GlobalText'; | ||
|
||
interface ReviewItemProps { | ||
onPress: () => void; | ||
} | ||
|
||
const ReviewItem = ({ onPress }: ReviewItemProps) => { | ||
// 한 줄에 2개씩 아이템 배치 | ||
const product = [...new Array(6).keys()] | ||
const splitArrayIntoPairs = (arr: any[], pairSize: number) => { | ||
return arr.reduce((result, item, index) => { | ||
if (index % pairSize === 0) { | ||
result.push([]); | ||
} | ||
result[result.length - 1].push(item); | ||
return result; | ||
}, []); | ||
}; | ||
const splitProduct = splitArrayIntoPairs(product, 2); | ||
return ( | ||
<View style={{ borderBottomWidth: 1, borderBottomColor: LIGHTGRAY }}> | ||
<ItemContainer style={{marginVertical: 10}}> | ||
<View style={{width: 40, height: 40, backgroundColor: GRAY, borderRadius: 180, marginRight: 10}} /> | ||
<View> | ||
<View style={{flexDirection: 'row', justifyContent: 'center', alignItems: 'center'}}> | ||
<Body16M>닉네임</Body16M> | ||
<Caption11M style={{color: BLACK2, marginLeft: 5}}>2024-01-01</Caption11M> | ||
</View> | ||
<StarRating /> | ||
</View> | ||
</ItemContainer> | ||
<Carousel | ||
data={splitProduct} | ||
renderItem={({item}: any) => { | ||
return ( | ||
<View style={{ flexDirection: 'row' }}> | ||
{item.map((subItem: any) => ( | ||
<View style={{width: '50%', paddingHorizontal: 20}}> | ||
<ImageBackground | ||
key={subItem.id} | ||
source={{uri:'https://image.made-in-china.com/2f0j00efRbSJMtHgqG/Denim-Bag-Youth-Fashion-Casual-Small-Mini-Square-Ladies-Shoulder-Bag-Women-Wash-Bags.webp'}} | ||
style={{width: '100%', height: 170 }} | ||
/> | ||
</View> | ||
))} | ||
</View> | ||
) | ||
}} | ||
slider | ||
/> | ||
<ItemContainer style={{marginTop: 10}}> | ||
<Body14B>거래</Body14B> | ||
<ReviewComment value='약속을 잘 지켜요' /> | ||
</ItemContainer> | ||
<ItemContainer style={{marginTop: 5}}> | ||
<Body14B>디자인</Body14B> | ||
<ReviewComment value='마무리가 꼼꼼해요' /> | ||
</ItemContainer> | ||
<Body14R style={{paddingHorizontal: 20, paddingVertical: 10}}>후기 내용이 들어가는 칸입니다 옷이 친절하고 사장님이 멋있어요 어쩌고저쩌고</Body14R> | ||
</View> | ||
) | ||
} | ||
|
||
const ItemContainer = styled.View` | ||
display: flex; | ||
flex-direction: row; | ||
padding: 5px 20px; | ||
` | ||
|
||
export default ReviewItem; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import styled from 'styled-components/native'; | ||
import Slider from '../../../common/Slider'; | ||
import { Caption11M } from '../../../styles/GlobalText'; | ||
|
||
interface ReviewSummary { | ||
|
||
} | ||
|
||
const ReviewSummary = () => { | ||
return ( | ||
<Container> | ||
<Caption11M></Caption11M> | ||
</Container> | ||
) | ||
} | ||
|
||
const Container = styled.View` | ||
display: flex; | ||
flex-direction: row; | ||
align-items: center; | ||
` | ||
|
||
export default ReviewSummary; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.