Skip to content

Commit 86055f3

Browse files
authored
�merge: log -> record 네이밍 변경 (#18)
�merge: log -> record 네이밍 변경 (#18)
2 parents e250a98 + f6af226 commit 86055f3

File tree

10 files changed

+113
-87
lines changed

10 files changed

+113
-87
lines changed

packages/react-native/src/components/common/Header.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
11
import { TouchableOpacity } from 'react-native-gesture-handler';
22
import React, { ReactElement, useEffect, useMemo } from 'react';
33
import { View } from 'react-native';
4-
import { AllRouteNavigation } from '@/types/navigation';
4+
import { useNavigation } from '@react-navigation/native';
55
import BackIcon from '@/assets/BackIcon';
66
import { useHeaderState } from '@/stores/header';
77
import { HEADER_STYLE } from '@/constants/HEADER_STYLE';
88

99
interface HeaderProps {
10-
navigation: AllRouteNavigation;
1110
title?: string;
1211
RightActionButton?: ReactElement;
1312
onBack?: () => void;
1413
}
1514

1615
export default function Header({
1716
title,
18-
navigation,
1917
RightActionButton,
2018
onBack,
2119
}: HeaderProps) {
2220
const { showHeader } = useHeaderState();
21+
const navigation = useNavigation();
2322

2423
const Right = useMemo(
2524
() => <View className="px-4">{RightActionButton}</View>,

packages/react-native/src/components/maps/LogCard.tsx

Lines changed: 0 additions & 49 deletions
This file was deleted.
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import {
2+
Dimensions,
3+
ImageBackground,
4+
TouchableOpacity,
5+
View,
6+
} from 'react-native';
7+
import { Font } from 'design-system';
8+
import { useNavigation } from '@react-navigation/native';
9+
import DotMenuIcon from '@/assets/DotMenuIcon';
10+
import { MapsStackNavigation } from '@/types/navigation';
11+
import { KoreaLocationName } from '@/types/map';
12+
13+
interface CardProps {
14+
id: number;
15+
title: string;
16+
location: KoreaLocationName;
17+
date: string;
18+
backgroundImage: string;
19+
}
20+
21+
const { width } = Dimensions.get('window');
22+
export const LOG_PADDING_X = 16;
23+
export const CARD_GAP = 8;
24+
25+
export default function RecordCard({
26+
id,
27+
title,
28+
location,
29+
date,
30+
backgroundImage,
31+
}: CardProps) {
32+
const navigation = useNavigation<MapsStackNavigation<'Maps/Record'>>();
33+
return (
34+
<TouchableOpacity
35+
onPress={() =>
36+
navigation.navigate('Maps/RecordDetail', {
37+
recordId: id,
38+
location,
39+
})
40+
}
41+
>
42+
<ImageBackground
43+
source={{ uri: backgroundImage }}
44+
className="h-[240px] rounded-lg overflow-hidden"
45+
style={{
46+
width: (width - 2 * LOG_PADDING_X - CARD_GAP) / 2,
47+
height: 240,
48+
}}
49+
>
50+
<View className="flex-1 justify-between px-3 py-1.5 bg-black/20">
51+
<View className="flex items-end w-full">
52+
<DotMenuIcon />
53+
</View>
54+
<View className="p-2.5 gap-2">
55+
<Font.Bold type="body1" color="white">
56+
{title}
57+
</Font.Bold>
58+
<Font.Light type="body1" color="white">
59+
{location}
60+
</Font.Light>
61+
<Font.Light type="body1" color="white">
62+
{date}
63+
</Font.Light>
64+
</View>
65+
</View>
66+
</ImageBackground>
67+
</TouchableOpacity>
68+
);
69+
}

packages/react-native/src/components/maps/LogCardList.tsx renamed to packages/react-native/src/components/maps/RecordCardList.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { View } from 'react-native';
2-
import LogCard, { CARD_GAP } from './LogCard';
2+
import RecordCard, { CARD_GAP } from './RecordCard';
3+
import { KoreaLocationName } from '@/types/map';
34

45
type MockCardData = {
56
id: number;
67
title: string;
7-
location: string;
8+
location: KoreaLocationName;
89
date: string;
910
backgroundImage: string;
1011
};
@@ -30,13 +31,13 @@ const MOCK_LOG_CARD: MockCardData[] = [
3031
id: 3,
3132
title: '이미지 구하기 귀찮다',
3233
date: '2024.08.04',
33-
location: '제주도',
34+
location: '제주특별자치도',
3435
backgroundImage:
3536
'https://img3.daumcdn.net/thumb/R658x0.q70/?fname=https://t1.daumcdn.net/news/202406/20/starfashion/20240620094035441whlh.jpg',
3637
},
3738
];
3839

39-
export default function LogCardList() {
40+
export default function RecordCardList() {
4041
return (
4142
<View
4243
className="mt-8 flex flex-row flex-wrap "
@@ -46,7 +47,8 @@ export default function LogCardList() {
4647
>
4748
{MOCK_LOG_CARD.map((data) => (
4849
<View key={data.title + data.backgroundImage}>
49-
<LogCard
50+
<RecordCard
51+
id={data.id}
5052
title={data.title}
5153
date={data.date}
5254
location={data.location}

packages/react-native/src/components/signup/common/Header.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ export default function SignupHeader({
1717
}: HeaderProps) {
1818
return (
1919
<Header
20-
navigation={navigation}
2120
onBack={onBack}
2221
RightActionButton={
2322
<TouchableOpacity onPress={onCancel}>

packages/react-native/src/pages/Maps/Maps.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export default function Maps({ navigation }: MapsMainProps) {
8989
<TouchableOpacity
9090
className="py-2"
9191
onPress={() =>
92-
navigation.navigate('Maps/Log', { location: region })
92+
navigation.navigate('Maps/Record', { location: region })
9393
}
9494
>
9595
<Font type="title1" color="black">
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { View } from 'react-native';
22

3-
export default function PostLog() {
3+
export default function PostRecord() {
44
return <View />;
55
}

packages/react-native/src/pages/Maps/Log.tsx renamed to packages/react-native/src/pages/Maps/Records.tsx

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,43 @@ import SortIcon from '@/assets/SortIcon';
44
import FloatingPlusButton from '@/components/maps/FloatingPlusButton';
55
import BackGroundGradient from '@/layouts/BackGroundGradient';
66
import { MapsRouteProps, MapsStackNavigation } from '@/types/navigation';
7-
import { LOG_PADDING_X } from '@/components/maps/LogCard';
8-
import LogCardList from '@/components/maps/LogCardList';
7+
import { LOG_PADDING_X } from '@/components/maps/RecordCard';
8+
import RecordCardList from '@/components/maps/RecordCardList';
99
import Header from '@/components/common/Header';
1010

11-
interface LogProps {
12-
navigation: MapsStackNavigation<'Maps/Log'>;
11+
interface RecordsProps {
12+
navigation: MapsStackNavigation<'Maps/Record'>;
1313
}
1414

15-
export default function Log({ navigation }: LogProps) {
15+
export default function Records({ navigation }: RecordsProps) {
1616
const sort = () => {
1717
// TODO: 실제 구현 필요(현재 UI없음)
1818
};
1919

20-
const route = useRoute<MapsRouteProps<'Maps/Log'>>();
20+
const route = useRoute<MapsRouteProps<'Maps/Record'>>();
2121
return (
2222
<View>
23-
<Header
24-
navigation={navigation}
25-
RightActionButton={
26-
<TouchableOpacity onPress={sort} className="px-4">
27-
<SortIcon />
28-
</TouchableOpacity>
29-
}
30-
title={route.params.location}
31-
/>
3223
<BackGroundGradient>
24+
<Header
25+
RightActionButton={
26+
<TouchableOpacity onPress={sort} className="px-4">
27+
<SortIcon />
28+
</TouchableOpacity>
29+
}
30+
title={route.params.location}
31+
/>
3332
<View
3433
className="relative flex-1 min-h-[100vh]"
3534
style={{
36-
padding: LOG_PADDING_X,
35+
paddingLeft: LOG_PADDING_X,
36+
paddingRight: LOG_PADDING_X,
3737
}}
3838
>
39-
<LogCardList />
39+
<RecordCardList />
4040
</View>
4141
</BackGroundGradient>
4242
<FloatingPlusButton
43-
onPress={() => navigation.navigate('Maps/PostLog')}
43+
onPress={() => navigation.navigate('Maps/PostRecord')}
4444
bottom={16}
4545
right={16}
4646
/>
Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
import { createStackNavigator } from '@react-navigation/stack';
22
import { KoreaLocationName } from '@/types/map';
33
import Maps from '@/pages/Maps/Maps';
4-
import Log from '@/pages/Maps/Log';
5-
import PostLog from '@/pages/Maps/PostLog';
6-
import ModifyLog from '@/pages/Maps/ModifyLog';
4+
import Records from '@/pages/Maps/Records';
5+
import PostRecord from '@/pages/Maps/PostRecord';
6+
import ModifyRecord from '@/pages/Maps/ModifyRecord';
7+
import RecordDetail from '@/pages/Maps/RecordDetail';
78

89
export type MapsStackParamList = {
910
'Maps/Main': undefined;
10-
'Maps/Log': {
11+
'Maps/Record': {
12+
location: KoreaLocationName;
13+
};
14+
'Maps/PostRecord': undefined;
15+
'Maps/ModifyRecord': undefined;
16+
'Maps/RecordDetail': {
17+
recordId: number;
1118
location: KoreaLocationName;
1219
};
13-
'Maps/PostLog': undefined;
14-
'Maps/ModifyLog': undefined;
1520
};
1621

1722
const Stack = createStackNavigator<MapsStackParamList>();
@@ -24,9 +29,10 @@ export default function MapsStackNavigator() {
2429
}}
2530
>
2631
<Stack.Screen name="Maps/Main" component={Maps} />
27-
<Stack.Screen name="Maps/Log" component={Log} />
28-
<Stack.Screen name="Maps/PostLog" component={PostLog} />
29-
<Stack.Screen name="Maps/ModifyLog" component={ModifyLog} />
32+
<Stack.Screen name="Maps/Record" component={Records} />
33+
<Stack.Screen name="Maps/PostRecord" component={PostRecord} />
34+
<Stack.Screen name="Maps/ModifyRecord" component={ModifyRecord} />
35+
<Stack.Screen name="Maps/RecordDetail" component={RecordDetail} />
3036
</Stack.Navigator>
3137
);
3238
}

0 commit comments

Comments
 (0)