From d890add22891f0ddf2531a5f8d8060a40107bf89 Mon Sep 17 00:00:00 2001 From: Louis Rouffineau Date: Tue, 14 Jan 2025 18:53:40 +0100 Subject: [PATCH] Better styling --- screens/Profile.tsx | 101 ++++++++++++++++++++------------------------ 1 file changed, 46 insertions(+), 55 deletions(-) diff --git a/screens/Profile.tsx b/screens/Profile.tsx index eebd92e64..3de534ebf 100644 --- a/screens/Profile.tsx +++ b/screens/Profile.tsx @@ -34,6 +34,7 @@ import { TouchableOpacity, View, useColorScheme, + ViewStyle, } from "react-native"; import { Text } from "@/design-system/Text"; import { useSafeAreaInsets } from "react-native-safe-area-context"; @@ -56,7 +57,7 @@ import { useWalletStore, } from "@/data/store/accountsStore"; import { useAccountsProfiles } from "@/utils/useAccountsProfiles"; -import { useAppTheme } from "@/theme/useAppTheme"; +import { ThemedStyle, useAppTheme } from "@/theme/useAppTheme"; import { navigate } from "@/utils/navigation"; import ActivityIndicator from "@components/ActivityIndicator/ActivityIndicator"; @@ -101,41 +102,9 @@ import { Gesture, GestureDetector } from "react-native-gesture-handler"; import { VStack } from "@/design-system/VStack"; import { Button } from "@/design-system/Button/Button"; -const useStyles = () => { - const colorScheme = useColorScheme(); - return StyleSheet.create({ - title: { - textAlign: "center", - fontSize: 34, - fontWeight: "bold", - marginVertical: 10, - color: textPrimaryColor(colorScheme), - }, - tableView: {}, - avatar: { - marginBottom: 10, - marginTop: 23, - alignSelf: "center", - }, - emoji: { - backgroundColor: "rgba(118, 118, 128, 0.12)", - borderRadius: 30, - }, - errorText: { - color: dangerColor(colorScheme), - textAlign: "center", - }, - errorContainer: { - flexDirection: "row", - alignSelf: "center", - }, - errorIcon: { - width: PictoSizes.textButton, - height: PictoSizes.textButton, - marginRight: 5, - }, - }); -}; +const $sectionContainer: ThemedStyle = ({ spacing }) => ({ + marginBottom: spacing.lg, +}); export default function ProfileScreen() { return ( @@ -194,10 +163,15 @@ const ContactCard = memo(function ContactCard({ backgroundColor: theme.colors.fill.primary, borderRadius: theme.borderRadius.xs, padding: theme.spacing.xl, - marginVertical: theme.spacing.md, + marginTop: theme.spacing.xs, + marginBottom: theme.spacing.lg, shadowColor: theme.colors.fill.primary, shadowOpacity: 0.25, - shadowRadius: 24, + shadowRadius: 12, + shadowOffset: { + width: 0, + height: 6, // Positive value pushes shadow down + }, elevation: 5, }; @@ -276,7 +250,7 @@ const ContactCard = memo(function ContactCard({ }); function ProfileScreenImpl() { - const { theme } = useAppTheme(); + const { theme, themed } = useAppTheme(); const router = useRouter(); const account = useCurrentAccount(); const accounts = useAccountsList(); @@ -288,7 +262,6 @@ function ProfileScreenImpl() { const preferredUserName = usePreferredName(peerAddress); const setPeersStatus = useSettingsStore((s) => s.setPeersStatus); const colorScheme = useColorScheme(); - const styles = useStyles(); useHeader( { @@ -512,7 +485,7 @@ function ProfileScreenImpl() { leftView: imageURI ? ( ) : ( - + ), rightView: ( )} @@ -885,14 +859,31 @@ function ProfileScreenImpl() { /> {isMyProfile && shouldShowError && ( - + - {translate("client_error")} + + {translate("client_error")} + )} @@ -918,7 +909,7 @@ function ProfileScreenImpl() { }, ]} title={translate("youre_the_og")} - style={styles.tableView} + style={themed($sectionContainer)} /> )} @@ -926,14 +917,14 @@ function ProfileScreenImpl() { 1 ? "S" : ""}`} - style={styles.tableView} + style={themed($sectionContainer)} /> )} {route.params?.fromGroupTopic && !isMyProfile && ( @@ -953,7 +944,7 @@ function ProfileScreenImpl() { }, }, ]} - style={styles.tableView} + style={themed($sectionContainer)} /> )} @@ -961,7 +952,7 @@ function ProfileScreenImpl() { )} {!isMyProfile && ( @@ -975,13 +966,13 @@ function ProfileScreenImpl() { leftView: , }))} title={translate("common_activity")} - style={styles.tableView} + style={themed($sectionContainer)} /> )} )} @@ -1111,7 +1102,7 @@ function ProfileScreenImpl() { !(notificationsPermissionStatus === "granted") )} title={translate("actions")} - style={styles.tableView} + style={themed($sectionContainer)} /> )}