aboutsummaryrefslogtreecommitdiff
path: root/src/components/profile/ProfileBody.tsx
diff options
context:
space:
mode:
authorAshm Walia <40498934+ashmgarv@users.noreply.github.com>2020-10-24 16:12:39 -0700
committerGitHub <noreply@github.com>2020-10-24 19:12:39 -0400
commit84d283b44f2b6cecb757edcd94e717a36c3ba3c3 (patch)
tree532a6c415c57b90bb90243b2d99845bb3e93d058 /src/components/profile/ProfileBody.tsx
parent8b680e97ad4689493d2c398281cc0da8e333aa04 (diff)
[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
Diffstat (limited to 'src/components/profile/ProfileBody.tsx')
-rw-r--r--src/components/profile/ProfileBody.tsx22
1 files changed, 21 insertions, 1 deletions
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>
);
};