diff options
author | Ashm Walia <40498934+ashmgarv@users.noreply.github.com> | 2020-12-22 08:50:27 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-22 11:50:27 -0500 |
commit | a954d6b6b88485dddc0ccfda634ffd102cb34ccd (patch) | |
tree | 560f152dd92ccb482a2bbf6b094060525373322c /src/components/common | |
parent | 49ed044f5103cf6288fcf5b3ff6d3d720795860c (diff) |
[TMA 446] Create category (#144)
* Added welcome page
* Working code
* Small fix
* Some more cleanup
* Fixes
* Cleanup
* Fix again
* Use gradient for white bg as well
* Fixed type
Diffstat (limited to 'src/components/common')
-rw-r--r-- | src/components/common/ComingSoon.tsx | 5 | ||||
-rw-r--r-- | src/components/common/TaggPopup.tsx | 133 | ||||
-rw-r--r-- | src/components/common/index.ts | 1 |
3 files changed, 138 insertions, 1 deletions
diff --git a/src/components/common/ComingSoon.tsx b/src/components/common/ComingSoon.tsx index 16b65b58..d7654a20 100644 --- a/src/components/common/ComingSoon.tsx +++ b/src/components/common/ComingSoon.tsx @@ -1,11 +1,14 @@ import * as React from 'react'; import {StyleSheet, View, Text, Image} from 'react-native'; +import {BackgroundGradientType} from '../../types'; import {SCREEN_WIDTH} from '../../utils'; import {Background} from '../onboarding'; const ComingSoon: React.FC = () => { return ( - <Background style={styles.container}> + <Background + style={styles.container} + gradientType={BackgroundGradientType.Light}> <View style={styles.textContainer}> <Text style={styles.header}>Coming Soon</Text> <Text style={styles.subtext}> diff --git a/src/components/common/TaggPopup.tsx b/src/components/common/TaggPopup.tsx new file mode 100644 index 00000000..db24adb8 --- /dev/null +++ b/src/components/common/TaggPopup.tsx @@ -0,0 +1,133 @@ +import {RouteProp} from '@react-navigation/native'; +import {StackNavigationProp} from '@react-navigation/stack'; +import * as React from 'react'; +import {Platform, Text, StyleSheet, TouchableOpacity} from 'react-native'; +import {Image, View} from 'react-native-animatable'; +import {ArrowButton} from '..'; +import {OnboardingStackParams} from '../../routes'; +import {SCREEN_HEIGHT, SCREEN_WIDTH} from '../../utils'; +import CloseIcon from '../../assets/ionicons/close-outline.svg'; + +type TaggPopupRouteProps = RouteProp<OnboardingStackParams, 'TaggPopup'>; +type TaggPopupNavigationProps = StackNavigationProp< + OnboardingStackParams, + 'TaggPopup' +>; + +interface TaggPopupProps { + route: TaggPopupRouteProps; + navigation: TaggPopupNavigationProps; +} + +const TaggPopup: React.FC<TaggPopupProps> = ({route, navigation}) => { + /** + * Custom popup / Tutorial screen for Tagg + * Just like a Singly Linked List, we have a next node + * if (next !== undefined) + * Display the next button and navigate to next popup node on click + * else + * Display close button, navigate back on close + */ + const {messageHeader, messageBody, next} = route.params.popupProps; + + return ( + <View style={styles.container}> + <View style={styles.popup}> + <Image + style={styles.icon} + source={require('../../assets/icons/plus-logo.png')} + /> + <View style={styles.textContainer}> + <Text style={styles.header}>{messageHeader}</Text> + <Text style={styles.subtext}>{messageBody}</Text> + </View> + {!next && ( + <TouchableOpacity + style={styles.closeButton} + onPress={() => { + navigation.goBack(); + }}> + <CloseIcon height={'50%'} width={'50%'} color={'white'} /> + </TouchableOpacity> + )} + </View> + {next && ( + <View style={styles.footer}> + <ArrowButton + direction="forward" + onPress={() => { + navigation.navigate('TaggPopup', {popupProps: next}); + }} + /> + </View> + )} + </View> + ); +}; + +const styles = StyleSheet.create({ + container: { + flex: 1, + flexDirection: 'column', + justifyContent: 'center', + alignItems: 'center', + }, + whiteColor: { + color: 'white', + }, + closeButton: { + position: 'relative', + height: '50%', + aspectRatio: 1, + left: '20%', + }, + textContainer: { + flex: 1, + flexDirection: 'column', + }, + icon: { + width: 40, + height: 40, + marginVertical: '1%', + }, + header: { + color: '#fff', + fontSize: 16, + fontWeight: '600', + textAlign: 'justify', + marginBottom: '2%', + marginHorizontal: '2%', + }, + subtext: { + color: '#fff', + fontSize: 12, + fontWeight: '600', + textAlign: 'justify', + marginBottom: '15%', + marginHorizontal: '2%', + }, + popup: { + width: SCREEN_WIDTH * 0.8, + height: SCREEN_WIDTH * 0.2, + backgroundColor: 'black', + borderRadius: 8, + flexDirection: 'row', + alignSelf: 'auto', + flexWrap: 'wrap', + position: 'absolute', + bottom: SCREEN_HEIGHT * 0.7, + }, + footer: { + marginLeft: '50%', + flexDirection: 'column-reverse', + ...Platform.select({ + ios: { + bottom: '20%', + }, + android: { + bottom: '10%', + }, + }), + }, +}); +export default TaggPopup; diff --git a/src/components/common/index.ts b/src/components/common/index.ts index 661d2f52..d5d36297 100644 --- a/src/components/common/index.ts +++ b/src/components/common/index.ts @@ -17,3 +17,4 @@ export {default as TaggDatePicker} from './TaggDatePicker'; export {default as BottomDrawer} from './BottomDrawer'; export {default as TaggLoadingTndicator} from './TaggLoadingIndicator'; export {default as GenericMoreInfoDrawer} from './GenericMoreInfoDrawer'; +export {default as TaggPopUp} from './TaggPopup'; |