Skip to content

Commit

Permalink
sdp-tech#11 feat: add market detail page view
Browse files Browse the repository at this point in the history
* sdp-tech#11 feat: add global style

* sdp-tech#11 feat: add market detail page
  • Loading branch information
SJ-Kwak authored Jan 24, 2024
1 parent 26b240a commit dd7f123
Show file tree
Hide file tree
Showing 10 changed files with 515 additions and 12 deletions.
20 changes: 14 additions & 6 deletions App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { View, TouchableOpacity, Text } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { NavigationContainer, DefaultTheme } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import { BottomTabBarProps, createBottomTabNavigator } from '@react-navigation/bottom-tabs';

Expand All @@ -12,9 +12,17 @@ import MyPageIcon from './src/assets/navbar/MyPage.svg';

const Stack = createNativeStackNavigator();

const GlobalTheme = {
...DefaultTheme,
colors: {
...DefaultTheme.colors,
background: 'white'
}
}

function App(): React.JSX.Element {
return (
<NavigationContainer>
<NavigationContainer theme={GlobalTheme}>
<Stack.Navigator
screenOptions={() => ({
headerShown: false,
Expand Down Expand Up @@ -65,10 +73,10 @@ const CustomTab = ({ state, descriptors, navigation }: BottomTabBarProps) => {
key={index}
onPress={onPress}
style={{
width: "20%",
display: "flex",
alignItems: "center",
justifyContent: "center",
width: '20%',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
}}
>
{
Expand Down
8 changes: 8 additions & 0 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -944,6 +944,10 @@ PODS:
- React-Mapbuffer (0.73.2):
- glog
- React-debug
- react-native-pager-view (6.2.3):
- glog
- RCT-Folly (= 2022.05.16.00)
- React-Core
- react-native-safe-area-context (4.8.2):
- React-Core
- React-nativeconfig (0.73.2)
Expand Down Expand Up @@ -1181,6 +1185,7 @@ DEPENDENCIES:
- React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector-modern`)
- React-logger (from `../node_modules/react-native/ReactCommon/logger`)
- React-Mapbuffer (from `../node_modules/react-native/ReactCommon`)
- react-native-pager-view (from `../node_modules/react-native-pager-view`)
- react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`)
- React-nativeconfig (from `../node_modules/react-native/ReactCommon`)
- React-NativeModulesApple (from `../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios`)
Expand Down Expand Up @@ -1280,6 +1285,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/logger"
React-Mapbuffer:
:path: "../node_modules/react-native/ReactCommon"
react-native-pager-view:
:path: "../node_modules/react-native-pager-view"
react-native-safe-area-context:
:path: "../node_modules/react-native-safe-area-context"
React-nativeconfig:
Expand Down Expand Up @@ -1373,6 +1380,7 @@ SPEC CHECKSUMS:
React-jsinspector: 03644c063fc3621c9a4e8bf263a8150909129618
React-logger: 66b168e2b2bee57bd8ce9e69f739d805732a5570
React-Mapbuffer: 9ee041e1d7be96da6d76a251f92e72b711c651d6
react-native-pager-view: d81ab2060b9caf57ca8c3a0d57467ff407cdb825
react-native-safe-area-context: 0ee144a6170530ccc37a0fd9388e28d06f516a89
React-nativeconfig: d753fbbc8cecc8ae413d615599ac378bbf6999bb
React-NativeModulesApple: 964f4eeab1b4325e8b6a799cf4444c3fd4eb0a9c
Expand Down
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@
"react-native-dotenv": "^3.4.9",
"react-native-gesture-handler": "^2.14.0",
"react-native-keychain": "^8.1.2",
"react-native-pager-view": "^6.2.3",
"react-native-safe-area-context": "^4.8.2",
"react-native-screens": "^3.29.0",
"react-native-svg": "^14.1.0"
"react-native-svg": "^14.1.0",
"react-native-tab-view": "^3.5.2",
"styled-components": "^6.1.8"
},
"devDependencies": {
"@babel/core": "^7.20.0",
Expand All @@ -36,6 +39,8 @@
"@types/react": "^18.2.6",
"@types/react-native-dotenv": "^0.2.2",
"@types/react-test-renderer": "^18.0.0",
"@types/styled-components": "^5.1.34",
"@types/styled-components-react-native": "^5.2.5",
"babel-jest": "^29.6.3",
"eslint": "^8.2.0",
"eslint-config-airbnb": "19.0.4",
Expand Down
3 changes: 3 additions & 0 deletions src/assets/common/LeftArrow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions src/common/Hashtag.tsx
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;
124 changes: 124 additions & 0 deletions src/components/Home/Market/MarketTabView.tsx
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;
3 changes: 3 additions & 0 deletions src/styles/GlobalColor.tsx
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';
Loading

0 comments on commit dd7f123

Please sign in to comment.