diff options
| author | Ivan Chen <ivan@tagg.id> | 2021-05-25 14:52:49 -0400 | 
|---|---|---|
| committer | Ivan Chen <ivan@tagg.id> | 2021-05-25 14:52:49 -0400 | 
| commit | 7f47d1f36255ff1e42efea1d0cf6c1b97fc557b1 (patch) | |
| tree | 8973bcf073efeb69a93a9b0fb162d7d8cee90904 /src/screens | |
| parent | 9df26f5ff25b4a6953518639d7dfcd16a03802a3 (diff) | |
Finish styling badges
Diffstat (limited to 'src/screens')
| -rw-r--r-- | src/screens/suggestedPeople/SPBody.tsx | 61 | 
1 files changed, 41 insertions, 20 deletions
| diff --git a/src/screens/suggestedPeople/SPBody.tsx b/src/screens/suggestedPeople/SPBody.tsx index 352e4433..9708a652 100644 --- a/src/screens/suggestedPeople/SPBody.tsx +++ b/src/screens/suggestedPeople/SPBody.tsx @@ -1,17 +1,11 @@  import {useNavigation} from '@react-navigation/native';  import React, {Fragment, useEffect, useMemo, useState} from 'react'; -import { -  ImageSourcePropType, -  ScrollView, -  StyleSheet, -  Text, -  View, -} from 'react-native'; +import {ImageSourcePropType, StyleSheet, Text, View} from 'react-native';  import {Image} from 'react-native-animatable';  import {TouchableOpacity} from 'react-native-gesture-handler';  import RequestedButton from '../../assets/ionicons/requested-button.svg'; -import {SPTaggsBar} from '../../components'; -import {BadgesDropdown, MutualFriends} from '../../components/suggestedPeople'; +import {UniversityIcon} from '../../components'; +import {BadgeIcon, MutualFriends} from '../../components/suggestedPeople';  import {BADGE_DATA} from '../../constants/badges';  import {    ProfilePreviewType, @@ -34,7 +28,6 @@ const SPBody: React.FC<SPBodyProps> = ({      user,      university,      mutual_friends, -    social_links,      suggested_people_url,      friendship,      badges, @@ -130,8 +123,7 @@ const SPBody: React.FC<SPBodyProps> = ({              userXId: loggedInUserId === user.id ? undefined : user.id,              screenType,            }); -        }} -        style={styles.nameInfoContainer}> +        }}>          <Text style={styles.firstName}>{user.first_name}</Text>          <Text style={styles.username}>@{user.username}</Text>        </TouchableOpacity> @@ -144,20 +136,35 @@ const SPBody: React.FC<SPBodyProps> = ({        <View style={styles.mainContainer}>          <View style={styles.topContainer}>            <Text style={styles.title}>{firstItem && 'Suggested People'}</Text> -          {localBadges && <BadgesDropdown {...{university, localBadges}} />} +          <UniversityIcon +            university={university} +            style={styles.universityIcon} +            imageStyle={styles.universityIcon} +          />          </View> -        <View style={styles.body}> +        <View>            <View style={styles.marginManager}>              <View style={styles.addUserContainer}>                <NamePlate />                {user.id !== loggedInUserId && <FriendButton />}              </View>            </View> -          <SPTaggsBar -            userXId={user.id === loggedInUserId ? undefined : user.id} -            screenType={screenType} -            linkedSocials={social_links} -          /> +          {localBadges.length !== 0 && ( +            // Badges aligned left and spaced as if there are 5 items +            <View style={styles.badgeContainer}> +              {localBadges.map(({badge, img}, index) => ( +                <BadgeIcon +                  key={index} +                  badge={badge} +                  img={img} +                  style={styles.badge} +                /> +              ))} +              {[0, 0, 0, 0, 0].splice(localBadges.length, 5).map((_, index) => ( +                <View key={index} style={styles.badge} /> +              ))} +            </View> +          )}            <View style={styles.marginManager}>              <MutualFriends user={user} friends={mutual_friends} />            </View> @@ -223,7 +230,6 @@ const styles = StyleSheet.create({      textShadowRadius: normalize(2),      letterSpacing: normalize(2),    }, -  nameInfoContainer: {},    addButton: {      justifyContent: 'center',      alignItems: 'center', @@ -271,6 +277,21 @@ const styles = StyleSheet.create({      shadowOffset: {width: 2, height: 2},      shadowOpacity: 0.5,    }, +  universityIcon: { +    left: '5%', +    width: normalize(31), +    height: normalize(38), +  }, +  badgeContainer: { +    flexDirection: 'row', +    alignItems: 'center', +    justifyContent: 'space-evenly', +    marginBottom: 25, +  }, +  badge: { +    width: normalize(52), +    height: normalize(52), +    borderWidth: 1,    },  }); | 
