|
@@ -1,11 +1,6 @@
|
|
|
-import React, { FC, ReactNode } from 'react';
|
|
|
-import { Text, TouchableOpacity, View } from 'react-native';
|
|
|
+import React from 'react';
|
|
|
|
|
|
-import { NavigationProp, useNavigation } from '@react-navigation/native';
|
|
|
-
|
|
|
-import { styles } from './styles';
|
|
|
-
|
|
|
-import { Header, PageWrapper } from '../../../../components';
|
|
|
+import { Header, PageWrapper, SettingsButton } from '../../../../components';
|
|
|
import { NAVIGATION_PAGES } from '../../../../types';
|
|
|
import { Colors } from '../../../../theme';
|
|
|
|
|
@@ -19,16 +14,9 @@ import ShieldIcon from '../../../../../assets/icons/shield.svg';
|
|
|
import ExitIcon from '../../../../../assets/icons/exit.svg';
|
|
|
import UserXMark from '../../../../../assets/icons/user-xmark.svg';
|
|
|
|
|
|
-import ArrowRightIcon from '../../../../../assets/icons/right-arrow.svg';
|
|
|
-
|
|
|
-type ButtonType = {
|
|
|
- label: string;
|
|
|
- icon: ReactNode;
|
|
|
- red?: boolean;
|
|
|
- buttonFn?: (navigationHook: NavigationProp<ReactNavigation.RootParamList>) => void;
|
|
|
-};
|
|
|
+import type { MenuButtonType } from '../../../../types/components';
|
|
|
|
|
|
-const buttons: ButtonType[] = [
|
|
|
+const buttons: MenuButtonType[] = [
|
|
|
{
|
|
|
label: 'Edit Profile',
|
|
|
icon: <UserPenIcon fill={Colors.DARK_BLUE} width={20} height={20} />,
|
|
@@ -88,30 +76,4 @@ const Settings = () => {
|
|
|
);
|
|
|
};
|
|
|
|
|
|
-type ButtonProps = {
|
|
|
- label: string;
|
|
|
- icon: ReactNode;
|
|
|
- buttonFn?: (navigate: NavigationProp<ReactNavigation.RootParamList>) => void;
|
|
|
- red?: boolean;
|
|
|
-};
|
|
|
-
|
|
|
-const SettingsButton: FC<ButtonProps> = ({ label, icon, buttonFn, red }) => {
|
|
|
- const navigation = useNavigation();
|
|
|
-
|
|
|
- return (
|
|
|
- <TouchableOpacity
|
|
|
- style={[styles.alignStyle, styles.buttonWrapper, { justifyContent: 'space-between' }]}
|
|
|
- onPress={() => (buttonFn ? buttonFn(navigation) : null)}
|
|
|
- >
|
|
|
- <View style={styles.alignStyle}>
|
|
|
- {icon}
|
|
|
- <Text style={[styles.buttonLabel, red ? { color: Colors.RED } : null]}>{label}</Text>
|
|
|
- </View>
|
|
|
- <View>
|
|
|
- <ArrowRightIcon fill={red ? Colors.RED : Colors.LIGHT_GRAY} width={20} height={20} />
|
|
|
- </View>
|
|
|
- </TouchableOpacity>
|
|
|
- );
|
|
|
-};
|
|
|
-
|
|
|
export default Settings;
|