From dd337186adc098595ec69ff54d4b86bdd2c60762 Mon Sep 17 00:00:00 2001 From: n0izn0iz Date: Fri, 6 Dec 2024 09:24:37 +0100 Subject: [PATCH] fix: show correct logo on mobile + space around mobile search button (#1445) Signed-off-by: Norman Meier --- package.json | 3 +- .../ScreenContainer/HeaderMobile.tsx | 60 +++++++++---------- packages/components/navigation/Sidebar.tsx | 9 ++- .../navigation/components/TopLogo.tsx | 49 +++++++-------- .../navigation/components/TopLogoMobile.tsx | 28 --------- 5 files changed, 59 insertions(+), 90 deletions(-) delete mode 100644 packages/components/navigation/components/TopLogoMobile.tsx diff --git a/package.json b/package.json index ed67ee40a5..6bda65456a 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,8 @@ "unused-exports": "ts-unused-exports ./tsconfig.json --excludePathsFromReport=\"packages/api;packages/contracts-clients;packages/evm-contracts-clients;packages/screens/RiotGame/RiotGameBridgeScreen.tsx;packages/components/socialFeed/RichText/inline-toolbar;app.config.js;weshd;./App.tsx;./cypress.config.ts;packages/modules/FileSystem/index.ts;.*\\.web|.electron|.native|.d.ts\"", "validate-networks": "tsx packages/scripts/validateNetworks.ts", "postinstall": "patch-package", - "install-gno": "tsx packages/scripts/install-gno" + "install-gno": "tsx packages/scripts/install-gno", + "switch-app": "tsx packages/scripts/switch-app" }, "engines": { "node": "v18.1.0" diff --git a/packages/components/ScreenContainer/HeaderMobile.tsx b/packages/components/ScreenContainer/HeaderMobile.tsx index 8108875d32..5df226f52c 100644 --- a/packages/components/ScreenContainer/HeaderMobile.tsx +++ b/packages/components/ScreenContainer/HeaderMobile.tsx @@ -1,6 +1,6 @@ import { useNavigation } from "@react-navigation/native"; import React, { FC } from "react"; -import { View, StyleSheet, TouchableOpacity, Platform } from "react-native"; +import { View, TouchableOpacity, Platform, ViewStyle } from "react-native"; import { useSelector } from "react-redux"; import hamburgerCrossSVG from "../../../assets/icons/hamburger-button-cross.svg"; @@ -17,7 +17,7 @@ import { ConnectWalletButtonMobile } from "../TopMenu/ConnectWalletButtonMobile" import { TogglePlayerButton } from "../mediaPlayer/TogglePlayerButton"; import { BackButton } from "../navigation/components/BackButton"; import { CartIconButtonBadge } from "../navigation/components/CartIconButtonBadge"; -import { TopLogoMobile } from "../navigation/components/TopLogoMobile"; +import { TopLogo } from "../navigation/components/TopLogo"; import { SpacerRow } from "../spacer"; export const HeaderMobile: FC<{ @@ -36,9 +36,9 @@ export const HeaderMobile: FC<{ const navigation = useNavigation(); return ( - - - + + + {onBackPress && ( <> @@ -54,10 +54,11 @@ export const HeaderMobile: FC<{ <> - )} + + { {currentRouteName === "Home" && } - + diff --git a/packages/components/navigation/components/TopLogo.tsx b/packages/components/navigation/components/TopLogo.tsx index c8720871ee..591ad0f989 100644 --- a/packages/components/navigation/components/TopLogo.tsx +++ b/packages/components/navigation/components/TopLogo.tsx @@ -1,44 +1,35 @@ import React from "react"; -import { View, TouchableOpacity, ViewStyle } from "react-native"; +import { View, TouchableOpacity, ViewStyle, StyleProp } from "react-native"; import logoTopVersionSVG from "@/assets/logos/logo-hexagon-version-alpha.svg"; import { SVG } from "@/components/SVG"; import { useAppConfig } from "@/context/AppConfigProvider"; import { useAppNavigation } from "@/hooks/navigation/useAppNavigation"; -import { layout } from "@/utils/style/layout"; -export const TopLogo = () => { +export const TopLogo: React.FC<{ + height?: number; + style?: StyleProp; +}> = ({ height = 68, style }) => { const navigation = useAppNavigation(); const { homeScreen, logo: configLogo } = useAppConfig(); const logoSource = configLogo || logoTopVersionSVG; - const logo = ; - - const style: ViewStyle = { - marginHorizontal: layout.spacing_x0_25, - overflow: "hidden", - }; - - const content = - homeScreen === "Home" ? ( - navigation.navigate(homeScreen as any)} - > - {logo} - - ) : ( - {logo} - ); + const logo = ( + + ); - return ( - navigation.navigate(homeScreen as any)} > - {content} - + {logo} + + ) : ( + {logo} ); }; diff --git a/packages/components/navigation/components/TopLogoMobile.tsx b/packages/components/navigation/components/TopLogoMobile.tsx deleted file mode 100644 index 15fb5c778b..0000000000 --- a/packages/components/navigation/components/TopLogoMobile.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import React, { FC } from "react"; -import { StyleSheet, View, TouchableOpacity } from "react-native"; - -import logoTopVersionMobileSVG from "../../../../assets/logos/logo-version-alpha-small.svg"; -import { SVG } from "../../SVG"; - -import { useAppNavigation } from "@/hooks/navigation/useAppNavigation"; - -export const TopLogoMobile: FC = () => { - const navigation = useAppNavigation(); - - return ( - - navigation.navigate("Home")}> - - - - ); -}; - -// FIXME: remove StyleSheet.create -// eslint-disable-next-line no-restricted-syntax -const styles = StyleSheet.create({ - topDetailContainer: { - flex: 1, - justifyContent: "center", - }, -});