-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Prakhar Agarwal <[email protected]>
- Loading branch information
1 parent
2751deb
commit d3a3354
Showing
4 changed files
with
124 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,122 @@ | ||
import { ScrollView } from "react-native-gesture-handler" | ||
|
||
import { Screen } from "@app/components/screen" | ||
import { makeStyles } from "@rneui/themed" | ||
import { GaloyPrimaryButton } from "@app/components/atomic/galoy-primary-button" | ||
import { useI18nContext } from "@app/i18n/i18n-react" | ||
import { RootStackParamList } from "@app/navigation/stack-param-lists" | ||
import { useNavigation } from "@react-navigation/native" | ||
import { StackNavigationProp } from "@react-navigation/stack" | ||
import { TouchableOpacity, View } from "react-native" | ||
import { GaloyIcon } from "@app/components/atomic/galoy-icon" | ||
import { makeStyles, Text, useTheme } from "@rneui/themed" | ||
|
||
export const ProfileScreen: React.FC = () => { | ||
const styles = useStyles() | ||
const { LL } = useI18nContext() | ||
const navigation = useNavigation<StackNavigationProp<RootStackParamList>>() | ||
|
||
const data = [ | ||
{ | ||
username: "User 1", | ||
selected: true, | ||
}, | ||
{ | ||
username: "User 2", | ||
selected: false, | ||
}, | ||
{ | ||
username: "User 3", | ||
selected: false, | ||
}, | ||
] | ||
|
||
return ( | ||
<Screen keyboardShouldPersistTaps="handled"> | ||
<ScrollView contentContainerStyle={styles.outer}></ScrollView> | ||
<ScrollView contentContainerStyle={styles.outer}> | ||
{data.map((profile, index) => { | ||
return <Profile key={index} {...profile} /> | ||
})} | ||
<GaloyPrimaryButton onPress={() => {}} containerStyle={styles.addNewButton}> | ||
<GaloyIcon name="user" size={30} style={styles.icon} /> | ||
<Text>{LL.ProfileScreen.addNew()}</Text> | ||
</GaloyPrimaryButton> | ||
</ScrollView> | ||
</Screen> | ||
) | ||
} | ||
|
||
const useStyles = makeStyles(() => ({ | ||
const Profile: React.FC<{ username: string; selected?: boolean }> = ({ | ||
username, | ||
selected, | ||
}) => { | ||
const styles = useStyles() | ||
const { | ||
theme: { colors }, | ||
} = useTheme() | ||
return ( | ||
<TouchableOpacity> | ||
<View style={styles.profile}> | ||
<View style={styles.iconContainer}> | ||
{selected && ( | ||
<GaloyIcon name="check-circle" size={30} style={styles.checkIcon} /> | ||
)} | ||
</View> | ||
<Text>{username}</Text> | ||
{!selected && ( | ||
<TouchableOpacity style={styles.logoutButton} onPress={() => {}}> | ||
<Text style={styles.logoutButtonText}>Logout</Text> | ||
</TouchableOpacity> | ||
)} | ||
</View> | ||
<View style={styles.divider}></View> | ||
</TouchableOpacity> | ||
) | ||
} | ||
|
||
const useStyles = makeStyles(({ colors }) => ({ | ||
outer: { | ||
marginTop: 4, | ||
paddingHorizontal: 12, | ||
paddingBottom: 20, | ||
display: "flex", | ||
flexDirection: "column", | ||
rowGap: 12, | ||
}, | ||
iconContainer: { | ||
height: 30, | ||
width: 30, | ||
marginRight: 10, | ||
justifyContent: "center", | ||
alignItems: "center", | ||
}, | ||
icon: { | ||
marginRight: 10, | ||
}, | ||
addNewButton: { | ||
marginVertical: 20, | ||
marginHorizontal: "auto", | ||
width: 150, | ||
}, | ||
divider: { | ||
borderWidth: 1, | ||
borderColor: colors.grey4, | ||
}, | ||
profile: { | ||
display: "flex", | ||
flexDirection: "row", | ||
alignItems: "center", | ||
marginBottom: 10, | ||
marginHorizontal: 10, | ||
}, | ||
checkIcon: { | ||
color: colors._green, | ||
margin: 10, | ||
}, | ||
logoutButton: { | ||
marginLeft: "auto", | ||
marginRight: 10, | ||
}, | ||
logoutButtonText: { | ||
color: colors.primary, | ||
fontSize: 20, | ||
fontWeight: "bold", | ||
}, | ||
})) |