-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merge: badge modal 추가 및 record추가시 뱃지 모달 추가 (#108)
merge: badge modal 추가 및 record추가시 뱃지 모달 추가 (#108)
- Loading branch information
Showing
5 changed files
with
111 additions
and
13 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
packages/react-native/src/components/common/BadgeModal.tsx
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,40 @@ | ||
import { PropsWithChildren } from 'react'; | ||
import { Modal, TouchableOpacity, View } from 'react-native'; | ||
import { Font } from 'design-system'; | ||
import CancelIcon from '@/assets/CancelIcon'; | ||
|
||
interface BadgeModalProps { | ||
visible: boolean; | ||
headerTitle?: string; | ||
handleClose: () => void; | ||
} | ||
|
||
export default function BadgeModal({ | ||
visible, | ||
headerTitle, | ||
handleClose, | ||
children, | ||
}: PropsWithChildren<BadgeModalProps>) { | ||
return ( | ||
<Modal visible={visible} transparent animationType="fade"> | ||
<View className="flex-1 justify-center text-center px-8"> | ||
<View className="p-4 bg-[#191919] rounded-xl"> | ||
<View className="justify-center flex-row"> | ||
{headerTitle && ( | ||
<Font type="body1" color="white"> | ||
{headerTitle} | ||
</Font> | ||
)} | ||
<TouchableOpacity | ||
onPress={handleClose} | ||
className="absolute right-0" | ||
> | ||
<CancelIcon /> | ||
</TouchableOpacity> | ||
</View> | ||
{children} | ||
</View> | ||
</View> | ||
</Modal> | ||
); | ||
} |
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
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 |
---|---|---|
@@ -1,15 +1,57 @@ | ||
import { useState } from 'react'; | ||
import { useNavigation, useRoute } from '@react-navigation/native'; | ||
import { View } from 'react-native'; | ||
import { Font } from 'design-system'; | ||
import Header from '@/components/common/Header'; | ||
import BackGroundGradient from '@/layouts/BackGroundGradient'; | ||
import { RecordFormProvider } from '@/hooks/useRecordFormState'; | ||
import RecordPostForm from '@/components/maps/RecordPostForm'; | ||
import { BADGE_MAPPER, Region, REVERSE_REGION_MAPPER } from '@/constants/CITY'; | ||
import Badge from '@/components/common/Badge'; | ||
import { StackNavigation, StackRouteProps } from '@/types/navigation'; | ||
import BadgeModal from '@/components/common/BadgeModal'; | ||
|
||
export default function PostRecord() { | ||
const [recordModalInfo, setRecordModalInfo] = useState<Region>(); | ||
const region = | ||
typeof recordModalInfo !== 'undefined' && | ||
REVERSE_REGION_MAPPER[recordModalInfo]; | ||
const navigate = useNavigation<StackNavigation<'Maps/Record'>>(); | ||
const { params } = useRoute<StackRouteProps<'Maps/PostRecord'>>(); | ||
|
||
const closeModal = () => { | ||
setRecordModalInfo(undefined); | ||
navigate.navigate('Maps/Record', { | ||
location: params.location, | ||
}); | ||
}; | ||
|
||
return ( | ||
<BackGroundGradient> | ||
<Header title="로그 등록" /> | ||
<RecordFormProvider> | ||
<RecordPostForm /> | ||
<RecordPostForm setRecordModalInfo={setRecordModalInfo} /> | ||
</RecordFormProvider> | ||
{typeof recordModalInfo !== 'undefined' && ( | ||
<BadgeModal | ||
visible={typeof recordModalInfo !== 'undefined'} | ||
handleClose={closeModal} | ||
> | ||
<View className="justify-center gap-2 flex-row items-center flex mt-6"> | ||
<Font.Bold type="title1" color="white"> | ||
{region} | ||
</Font.Bold> | ||
</View> | ||
<View className="justify-center items-center"> | ||
<Font type="body1" color="white"> | ||
배지를 1개 획득했습니다. | ||
</Font> | ||
<View className="p-4"> | ||
<Badge preventFade location={BADGE_MAPPER[recordModalInfo]} /> | ||
</View> | ||
</View> | ||
</BadgeModal> | ||
)} | ||
</BackGroundGradient> | ||
); | ||
} |