aboutsummaryrefslogtreecommitdiff
path: root/src/components/profile/ProfileBody.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/profile/ProfileBody.tsx')
-rw-r--r--src/components/profile/ProfileBody.tsx33
1 files changed, 26 insertions, 7 deletions
diff --git a/src/components/profile/ProfileBody.tsx b/src/components/profile/ProfileBody.tsx
index 7091a077..db8c6e0b 100644
--- a/src/components/profile/ProfileBody.tsx
+++ b/src/components/profile/ProfileBody.tsx
@@ -1,21 +1,26 @@
import React from 'react';
import {StyleSheet, View, Text, LayoutChangeEvent} from 'react-native';
+import {TOGGLE_BUTTON_TYPE} from '../../constants';
import {AuthContext, ProfileContext} from '../../routes/';
-import FollowUnfollow from './FollowUnfollow';
+import ToggleButton from './ToggleButton';
interface ProfileBodyProps {
onLayout: (event: LayoutChangeEvent) => void;
isProfileView: boolean;
- followed: boolean;
+ isFollowed: boolean;
+ isBlocked: boolean;
isOwnProfile: boolean;
handleFollowUnfollow: Function;
+ handleBlockUnblock: Function;
}
const ProfileBody: React.FC<ProfileBodyProps> = ({
onLayout,
isProfileView,
- followed,
+ isFollowed,
+ isBlocked,
isOwnProfile,
handleFollowUnfollow,
+ handleBlockUnblock,
}) => {
const {
profile,
@@ -32,10 +37,20 @@ const ProfileBody: React.FC<ProfileBodyProps> = ({
<Text style={styles.biography}>{`${biography}`}</Text>
<Text style={styles.website}>{`${website}`}</Text>
{isProfileView && !isOwnProfile ? (
- <FollowUnfollow
- followed={followed}
- handleFollowUnfollow={handleFollowUnfollow}
- />
+ <View style={styles.toggleButtonContainer}>
+ {!isBlocked && (
+ <ToggleButton
+ toggleState={isFollowed}
+ handleToggle={handleFollowUnfollow}
+ buttonType={TOGGLE_BUTTON_TYPE.FOLLOW_UNFOLLOW}
+ />
+ )}
+ <ToggleButton
+ toggleState={isBlocked}
+ handleToggle={handleBlockUnblock}
+ buttonType={TOGGLE_BUTTON_TYPE.BLOCK_UNBLOCK}
+ />
+ </View>
) : (
<></>
)}
@@ -44,6 +59,10 @@ const ProfileBody: React.FC<ProfileBodyProps> = ({
};
const styles = StyleSheet.create({
+ toggleButtonContainer: {
+ flexDirection: 'row',
+ flex: 1,
+ },
container: {
paddingVertical: 5,
paddingHorizontal: 20,