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 detail page view
* sdp-tech#11 feat: add global style * sdp-tech#11 feat: add market detail page
- Loading branch information
Showing
10 changed files
with
515 additions
and
12 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { useState } from 'react'; | ||
import { View, Text, TouchableOpacity } from 'react-native'; | ||
import styled from 'styled-components/native'; | ||
import { Filter14M } from '../styles/GlobalText'; | ||
import { PURPLE } from '../styles/GlobalColor'; | ||
|
||
interface HashtagParams { | ||
value: string; | ||
pressable?: boolean; | ||
} | ||
|
||
const Hashtag = ({value, pressable} : HashtagParams) => { | ||
const [pressed, setPressed] = useState<boolean>(false); | ||
return ( | ||
<HashtagContainer pressed={pressed} onPress={() => setPressed(!pressed)} disabled={!pressable}> | ||
<Filter14M style={{color: pressed ? PURPLE : 'white'}}>{value}</Filter14M> | ||
</HashtagContainer> | ||
) | ||
} | ||
|
||
const HashtagContainer = styled.TouchableOpacity<{ pressed: boolean }>` | ||
display: flex; | ||
border-radius: 12px; | ||
justify-content: center; | ||
align-items: center; | ||
padding: 4px 16px; | ||
margin: 5px; | ||
background: ${(props: { pressed: boolean }) => props.pressed ? 'white' : PURPLE}; | ||
border-color: ${PURPLE}; | ||
border-width: 1px; | ||
` | ||
|
||
export default Hashtag; |
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,124 @@ | ||
import { useState } from 'react'; | ||
import { SafeAreaView, ScrollView, View, Text, TouchableOpacity, useWindowDimensions } from 'react-native'; | ||
import styled from 'styled-components/native'; | ||
import { TabView, TabBar, SceneMap } from "react-native-tab-view"; | ||
import { Title20B, Body14R, Caption11M } from '../../../styles/GlobalText.tsx'; | ||
|
||
import { StackScreenProps } from '@react-navigation/stack'; | ||
import { HomeStackParams } from '../../../pages/Home'; | ||
|
||
import LeftArrow from '../../../assets/common/LeftArrow.svg'; | ||
import { FlatList } from 'react-native-gesture-handler'; | ||
import Hashtag from '../../../common/Hashtag.tsx'; | ||
|
||
const ProfileSection = () => { | ||
const filter = ['스포티', '영캐주얼', '깔끔'] | ||
return ( | ||
<View style={{alignItems: 'center'}}> | ||
<View style={{backgroundColor: '#BDBDBD', width: 90, height: 90, borderRadius: 180}} /> | ||
<Title20B style={{marginTop: 8}}>이하늘의 마켓</Title20B> | ||
<View style={{flexDirection: 'row', alignItems: 'center'}}> | ||
<Body14R>안녕하세요 리폼러 이하늘입니다!</Body14R> | ||
<TouchableOpacity> | ||
<Caption11M style={{opacity: 0.5, marginLeft: 5}}>...더보기</Caption11M> | ||
</TouchableOpacity> | ||
</View> | ||
<FlatList | ||
horizontal | ||
scrollEnabled={false} | ||
data={filter} | ||
renderItem={({item}) => { | ||
return ( | ||
<Hashtag value={item} pressable={false} /> | ||
) | ||
}} | ||
/> | ||
</View> | ||
) | ||
} | ||
|
||
const InfoPage = () => { | ||
return ( | ||
<View> | ||
<Text>정보</Text> | ||
</View> | ||
) | ||
} | ||
|
||
const ProductPage = () => { | ||
return ( | ||
<View> | ||
<Text>상품</Text> | ||
</View> | ||
) | ||
} | ||
|
||
const ReviewPage = () => { | ||
return ( | ||
<View> | ||
<Text>리뷰</Text> | ||
</View> | ||
) | ||
} | ||
|
||
const MarketTabView = ({ navigation, route } : StackScreenProps<HomeStackParams, 'Market'>) => { | ||
const layout = useWindowDimensions(); | ||
const [index, setIndex] = useState<number>(0); | ||
const [routes] = useState([ | ||
{ key: 'info', title: '정보'}, | ||
{ key: 'product', title: '상품' }, | ||
{ key: 'review', title: '리뷰' } | ||
]); | ||
|
||
const renderScene = ({ route }: any) => { | ||
switch (route.key) { | ||
case 'info': | ||
return <InfoPage />; | ||
case 'product': | ||
return <ProductPage />; | ||
case 'review': | ||
return <ReviewPage />; | ||
} | ||
} | ||
|
||
return ( | ||
<SafeAreaView style={{flex: 1}}> | ||
<BackButton onPress={() => navigation.goBack()}> | ||
<LeftArrow /> | ||
</BackButton> | ||
<ProfileSection /> | ||
<TabView | ||
navigationState={{ index, routes }} | ||
renderScene={renderScene} | ||
onIndexChange={setIndex} | ||
initialLayout={{ width: layout.width }} | ||
renderTabBar={props => ( | ||
<TabBar | ||
{...props} | ||
indicatorContainerStyle={{ | ||
borderBottomColor: '#DFDFDF', | ||
borderBottomWidth: 2 | ||
}} | ||
indicatorStyle={{ | ||
backgroundColor: '#BDBDBD', | ||
height: 2 | ||
}} | ||
style={{ | ||
backgroundColor: 'white', | ||
}} | ||
labelStyle={{ | ||
color: 'black' | ||
}} | ||
pressColor='black' | ||
/> | ||
)} | ||
/> | ||
</SafeAreaView> | ||
) | ||
} | ||
|
||
const BackButton = styled.TouchableOpacity` | ||
padding: 10px; | ||
` | ||
|
||
export default MarketTabView; |
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,3 @@ | ||
export const PURPLE = '#612FEF'; | ||
export const GREEN = '#DBFC72'; | ||
export const BLACK = '#222222'; |
Oops, something went wrong.