From ebf69b2dc12b3109e3556c7e3a07ea3037a2ae53 Mon Sep 17 00:00:00 2001 From: Justin Shillingford Date: Mon, 10 Aug 2020 17:37:40 -0400 Subject: [TMA-65] Onboarding Link Social Media UI (#29) * Basic setup for SocialMediaLinker component * Added social media icons * Displayed 3 main social components * Layout components in a row * Added base Show More/Less button * Display all 9 socials with Show More button * Added different font colors for each linker * Realized that the check doesn't replace the text * Added type-checking to some constants * Updated state name * Fixed Checkpoint.tsx merge issue * Removed unnecessary path element * Fixed type issues on Verification.tsx --- src/screens/main/Home.tsx | 56 +++++++++++++++++++++++++++++++---- src/screens/onboarding/Checkpoint.tsx | 7 +++-- 2 files changed, 54 insertions(+), 9 deletions(-) (limited to 'src/screens') diff --git a/src/screens/main/Home.tsx b/src/screens/main/Home.tsx index 86f9b2ba..7b6f1aaf 100644 --- a/src/screens/main/Home.tsx +++ b/src/screens/main/Home.tsx @@ -1,7 +1,8 @@ import React from 'react'; -import {Text} from 'react-native-animatable'; -import {StyleSheet} from 'react-native'; -import {GradientBackground} from '../../components'; +import {StyleSheet, View, TouchableOpacity, Text} from 'react-native'; +import {GradientBackground, SocialMediaLinker} from '../../components'; +import {LinkerType} from 'src/types'; +import {SOCIAL_LIST} from '../../constants/'; /** * Home Screen for displaying Tagg post suggestions @@ -9,16 +10,59 @@ import {GradientBackground} from '../../components'; */ const Home: React.FC = () => { + const linkers: Array = []; + const [state, setState] = React.useState({ + showMore: false, + }); + + let numSocials: Number = state.showMore ? 9 : 3; + + for (let i = 0; i < numSocials; i++) { + let linker: LinkerType = { + label: SOCIAL_LIST[i], + }; + linkers.push(linker); + } + + const handleShowPress = () => { + setState({ + ...state, + showMore: !state.showMore, + }); + }; + return ( - Tagg Home Screen 🏠 + + {linkers.map((linker, index) => ( + + ))} + + {state.showMore && Show Less 🔼} + {!state.showMore && Show More 🔽} + + ); }; + const styles = StyleSheet.create({ - text: { + container: { + flexDirection: 'row', + height: '19%', + flexWrap: 'wrap', justifyContent: 'center', - backgroundColor: 'transparent', + alignContent: 'center', + }, + show: { + borderColor: '#fff', + borderWidth: 1, + borderRadius: 3, + paddingHorizontal: '2%', + paddingVertical: '1%', + marginVertical: '3%', + marginLeft: '65%', }, }); + export default Home; diff --git a/src/screens/onboarding/Checkpoint.tsx b/src/screens/onboarding/Checkpoint.tsx index 013a80d2..4a58548e 100644 --- a/src/screens/onboarding/Checkpoint.tsx +++ b/src/screens/onboarding/Checkpoint.tsx @@ -10,12 +10,13 @@ import { TouchableOpacity, } from 'react-native'; -import {RootStackParamList, AuthContext} from '../../routes'; +import {OnboardingStackParams} from '../../routes'; +import {AuthContext} from '../../routes/authentication'; import {RegistrationWizard, Background} from '../../components'; -type CheckpointRouteProp = RouteProp; +type CheckpointRouteProp = RouteProp; type CheckpointNavigationProp = StackNavigationProp< - RootStackParamList, + OnboardingStackParams, 'Checkpoint' >; interface CheckpointProps { -- cgit v1.2.3-70-g09d2