aboutsummaryrefslogtreecommitdiff
path: root/src/components/onboarding/UniversitySelection.tsx
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-03-29 14:02:31 -0400
committerIvan Chen <ivan@tagg.id>2021-03-29 14:02:31 -0400
commit04bf806285e7626644234b7febee2dad5c912f8d (patch)
tree9ed3ec581792d6a0e1135f02a1d4716890ca75fc /src/components/onboarding/UniversitySelection.tsx
parente8324a7278a82d926acceedc10921f0b14e6d403 (diff)
parent4de1ebd43437712e28a89bb624c5b12afad45cc6 (diff)
Merge branch 'master' into tma-701-private-account-banner
# Conflicts: # src/constants/strings.ts
Diffstat (limited to 'src/components/onboarding/UniversitySelection.tsx')
-rw-r--r--src/components/onboarding/UniversitySelection.tsx97
1 files changed, 97 insertions, 0 deletions
diff --git a/src/components/onboarding/UniversitySelection.tsx b/src/components/onboarding/UniversitySelection.tsx
new file mode 100644
index 00000000..92bec47f
--- /dev/null
+++ b/src/components/onboarding/UniversitySelection.tsx
@@ -0,0 +1,97 @@
+import React from 'react';
+import {Image, ImageSourcePropType, StyleSheet, Text, View} from 'react-native';
+import {TouchableOpacity} from 'react-native-gesture-handler';
+import {UniversityType} from '../../types';
+import {normalize} from '../../utils';
+
+interface UniversitySelectionProps {
+ selected: UniversityType;
+ setSelected: (selected: UniversityType) => void;
+}
+
+const UniversitySelection: React.FC<UniversitySelectionProps> = ({
+ selected,
+ setSelected,
+}) => {
+ const crestData = [
+ {
+ imagePath: require('../../assets/universities/brown.png'),
+ title: 'Brown',
+ key: UniversityType.Brown,
+ },
+ {
+ imagePath: require('../../assets/universities/cornell.png'),
+ title: 'Cornell',
+ key: UniversityType.Cornell,
+ },
+ // {
+ // imagePath: require('../../assets/universities/harvard.png'),
+ // title: 'Harvard',
+ // key: UniversityType.Harvard,
+ // },
+ ];
+ const renderButton = (
+ imagePath: ImageSourcePropType,
+ title: string,
+ key: UniversityType,
+ ) => (
+ <TouchableOpacity
+ style={
+ selected === key ? styles.crestContainerSelected : styles.crestContainer
+ }
+ onPress={() => setSelected(key)}>
+ <Image source={imagePath} style={styles.crest} />
+ <Text style={styles.crestLabel}>{title}</Text>
+ </TouchableOpacity>
+ );
+ return (
+ <>
+ <Text style={styles.title}>University Badge</Text>
+ <View style={styles.container}>
+ {crestData.map((data) =>
+ renderButton(data.imagePath, data.title, data.key),
+ )}
+ </View>
+ </>
+ );
+};
+
+const styles = StyleSheet.create({
+ title: {
+ color: 'white',
+ fontSize: normalize(15),
+ lineHeight: normalize(18),
+ fontWeight: '700',
+ marginBottom: 10,
+ },
+ container: {
+ flexDirection: 'row',
+ justifyContent: 'space-around',
+ marginBottom: 10,
+ },
+ crest: {
+ height: normalize(25),
+ aspectRatio: 31 / 38,
+ marginBottom: 5,
+ },
+ crestContainer: {
+ alignItems: 'center',
+ padding: 10,
+ },
+ crestContainerSelected: {
+ alignItems: 'center',
+ borderWidth: 2,
+ borderColor: 'white',
+ borderRadius: 5,
+ padding: 8,
+ backgroundColor: '#fff2',
+ },
+ crestLabel: {
+ color: 'white',
+ fontSize: normalize(15),
+ lineHeight: normalize(18),
+ fontWeight: '500',
+ },
+});
+
+export default UniversitySelection;