From 84d283b44f2b6cecb757edcd94e717a36c3ba3c3 Mon Sep 17 00:00:00 2001
From: Ashm Walia <40498934+ashmgarv@users.noreply.github.com>
Date: Sat, 24 Oct 2020 16:12:39 -0700
Subject: [TMA 301] Add follow/unfollow button to profile (#70)

* Follow Unfollow User

* Fixed an issue and moved api call to Content.tsx

* last

* Small changes
---
 src/components/profile/ProfileBody.tsx | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

(limited to 'src/components/profile/ProfileBody.tsx')

diff --git a/src/components/profile/ProfileBody.tsx b/src/components/profile/ProfileBody.tsx
index 53b86708..7091a077 100644
--- a/src/components/profile/ProfileBody.tsx
+++ b/src/components/profile/ProfileBody.tsx
@@ -1,24 +1,44 @@
 import React from 'react';
 import {StyleSheet, View, Text, LayoutChangeEvent} from 'react-native';
 import {AuthContext, ProfileContext} from '../../routes/';
+import FollowUnfollow from './FollowUnfollow';
 
 interface ProfileBodyProps {
   onLayout: (event: LayoutChangeEvent) => void;
   isProfileView: boolean;
+  followed: boolean;
+  isOwnProfile: boolean;
+  handleFollowUnfollow: Function;
 }
-const ProfileBody: React.FC<ProfileBodyProps> = ({onLayout, isProfileView}) => {
+const ProfileBody: React.FC<ProfileBodyProps> = ({
+  onLayout,
+  isProfileView,
+  followed,
+  isOwnProfile,
+  handleFollowUnfollow,
+}) => {
   const {
     profile,
     user: {username},
   } = isProfileView
     ? React.useContext(ProfileContext)
     : React.useContext(AuthContext);
+
   const {biography, website} = profile;
+
   return (
     <View onLayout={onLayout} style={styles.container}>
       <Text style={styles.username}>{`@${username}`}</Text>
       <Text style={styles.biography}>{`${biography}`}</Text>
       <Text style={styles.website}>{`${website}`}</Text>
+      {isProfileView && !isOwnProfile ? (
+        <FollowUnfollow
+          followed={followed}
+          handleFollowUnfollow={handleFollowUnfollow}
+        />
+      ) : (
+        <></>
+      )}
     </View>
   );
 };
-- 
cgit v1.2.3-70-g09d2

