From a6b43f5e2a5455ea7ba8dfb98e9befcdb55b1cc0 Mon Sep 17 00:00:00 2001 From: clegirar Date: Fri, 3 Jan 2025 11:33:26 +0100 Subject: [PATCH] fix: fontWeight and fullWidth for Wallet manager screen Signed-off-by: clegirar --- packages/components/Menu.tsx | 4 +- packages/components/buttons/MaxButton.tsx | 4 +- packages/components/hub/MyNFTs.tsx | 29 +++----- .../components/hub/WalletDashboardHeader.tsx | 34 +++------- .../components/inputs/TextInputCustom.tsx | 9 ++- .../modals/DepositWithdrawModal.tsx | 25 ++++--- packages/screens/WalletManager/Assets.tsx | 41 ++++-------- packages/screens/WalletManager/WalletItem.tsx | 66 ++++++------------- .../WalletManager/WalletManagerScreen.tsx | 9 ++- .../screens/WalletManager/WalletsScreen.tsx | 16 ++--- packages/utils/style/fonts.ts | 7 ++ 11 files changed, 97 insertions(+), 147 deletions(-) diff --git a/packages/components/Menu.tsx b/packages/components/Menu.tsx index 5b4b85e7c4..92534995ca 100644 --- a/packages/components/Menu.tsx +++ b/packages/components/Menu.tsx @@ -6,7 +6,7 @@ import { PrimaryBox } from "./boxes/PrimaryBox"; import { useDropdowns } from "@/hooks/useDropdowns"; import { neutral33 } from "@/utils/style/colors"; -import { fontSemibold13 } from "@/utils/style/fonts"; +import { fontRegular13 } from "@/utils/style/fonts"; import { layout } from "@/utils/style/layout"; const DEFAULT_WIDTH = 164; @@ -62,7 +62,7 @@ export const Menu: React.FC = ({ ]} > {item.label} diff --git a/packages/components/buttons/MaxButton.tsx b/packages/components/buttons/MaxButton.tsx index 3eff1c6978..d99c9ebce0 100644 --- a/packages/components/buttons/MaxButton.tsx +++ b/packages/components/buttons/MaxButton.tsx @@ -2,7 +2,7 @@ import React from "react"; import { Pressable, StyleSheet } from "react-native"; import { neutral22, primaryColor } from "../../utils/style/colors"; -import { fontSemibold12 } from "../../utils/style/fonts"; +import { fontRegular12 } from "../../utils/style/fonts"; import { layout } from "../../utils/style/layout"; import { BrandText } from "../BrandText"; @@ -22,7 +22,7 @@ export const MaxButton = ({ onPress }: MaxButtonProps) => { // eslint-disable-next-line no-restricted-syntax const styles = StyleSheet.create({ maxText: { - ...StyleSheet.flatten(fontSemibold12), + ...StyleSheet.flatten(fontRegular12), backgroundColor: primaryColor, color: neutral22, borderRadius: layout.borderRadius, diff --git a/packages/components/hub/MyNFTs.tsx b/packages/components/hub/MyNFTs.tsx index 42f6102a1e..ee411c6201 100644 --- a/packages/components/hub/MyNFTs.tsx +++ b/packages/components/hub/MyNFTs.tsx @@ -10,6 +10,8 @@ import { OmniLink } from "../OmniLink"; import { SVG } from "../SVG"; import { NFTView } from "../nfts/NFTView"; +import { fontRegular14, fontRegular20 } from "@/utils/style/fonts"; + export const MyNFTs: React.FC = () => { const selectedWallet = useSelectedWallet(); @@ -25,11 +27,7 @@ export const MyNFTs: React.FC = () => { priceRange: undefined, }); return ( - + { marginBottom: 24, }} > - My NFTs + + My NFTs + - + See All - + = ({ position: "relative", }} > - - {title} - - - {data} - + {title} + {data} {!!actionButton && ( { - + Hello {userInfo.metadata?.tokenId || diff --git a/packages/components/inputs/TextInputCustom.tsx b/packages/components/inputs/TextInputCustom.tsx index c1ed96342a..15d5a86f8c 100644 --- a/packages/components/inputs/TextInputCustom.tsx +++ b/packages/components/inputs/TextInputCustom.tsx @@ -49,6 +49,8 @@ import { LegacyTertiaryBox } from "../boxes/LegacyTertiaryBox"; import { CustomPressable } from "../buttons/CustomPressable"; import { SpacerColumn, SpacerRow } from "../spacer"; +import { useTheme } from "@/hooks/useTheme"; + // TODO: Refacto TextInputCustom. Too much props export interface TextInputCustomProps @@ -164,6 +166,7 @@ export const TextInputCustom = ({ }); const inputRef = useRef(null); const [hovered, setHovered] = useState(false); + const theme = useTheme(); // Passing ref to parent since I didn't find a pattern to handle generic argument AND forwardRef useEffect(() => { if (inputRef.current && setRef) { @@ -313,7 +316,11 @@ export const TextInputCustom = ({ onKeyPress={(event) => handleKeyPress({ event, onPressEnter })} placeholderTextColor={neutral77} value={field.value} - style={[styles.textInput, textInputStyle]} + style={[ + { color: theme.textColor }, + styles.textInput, + textInputStyle, + ]} {...restProps} /> diff --git a/packages/components/modals/DepositWithdrawModal.tsx b/packages/components/modals/DepositWithdrawModal.tsx index 8056d5e59a..b7763a2bdb 100644 --- a/packages/components/modals/DepositWithdrawModal.tsx +++ b/packages/components/modals/DepositWithdrawModal.tsx @@ -18,7 +18,11 @@ import { keplrCurrencyFromNativeCurrencyInfo, } from "../../networks"; import { neutral77, primaryColor } from "../../utils/style/colors"; -import { fontSemibold13, fontSemibold14 } from "../../utils/style/fonts"; +import { + fontRegular13, + fontRegular14, + fontRegular16, +} from "../../utils/style/fonts"; import { layout } from "../../utils/style/layout"; import { capitalize, tinyAddress } from "../../utils/text"; import { BrandText } from "../BrandText"; @@ -83,7 +87,7 @@ export const DepositWithdrawModal: React.FC = ({ - + {variation === "deposit" ? "Deposit on" : "Withdraw from"}{" "} {getNetwork(networkId)?.displayName || "Unknown"} @@ -110,7 +114,7 @@ export const DepositWithdrawModal: React.FC = ({ width={460} > - + {capitalize(variation)} {nativeTargetCurrency?.displayName} @@ -120,7 +124,7 @@ export const DepositWithdrawModal: React.FC = ({ - + From {sourceNetwork?.displayName || "Unknown"} @@ -149,7 +153,7 @@ export const DepositWithdrawModal: React.FC = ({ /> - + To {destinationNetwork?.displayName || "Unknown"} @@ -175,9 +179,9 @@ export const DepositWithdrawModal: React.FC = ({ rules={{ required: true, max }} placeHolder="0" subtitle={ - + Available:{" "} - + {max} @@ -329,12 +333,7 @@ const styles = StyleSheet.create({ container: { paddingBottom: layout.spacing_x3, }, - estimatedText: StyleSheet.flatten([ - fontSemibold14, - { - color: neutral77, - }, - ]), + estimatedText: StyleSheet.flatten([fontRegular14, { color: neutral77 }]), }); const convertCosmosAddress = ( diff --git a/packages/screens/WalletManager/Assets.tsx b/packages/screens/WalletManager/Assets.tsx index 4a4e70d736..b38c18536a 100644 --- a/packages/screens/WalletManager/Assets.tsx +++ b/packages/screens/WalletManager/Assets.tsx @@ -14,6 +14,11 @@ import { useIsMobile } from "@/hooks/useIsMobile"; import { parseUserId } from "@/networks"; import { prettyPrice } from "@/utils/coins"; import { neutral22, neutral33 } from "@/utils/style/colors"; +import { + fontRegular14, + fontRegular18, + fontRegular20, +} from "@/utils/style/fonts"; const collapsedCount = 5; @@ -81,7 +86,7 @@ export const Assets: React.FC<{ alignItems: "center", }} > - + Assets on {network.displayName} @@ -92,13 +97,7 @@ export const Assets: React.FC<{ alignItems: "center", }} > - + {expanded ? "Collapse" : "Expand"} All Items - + - + {prettyPrice( network.id, balance?.amount || "0", currency.denom, )} - + {balance?.usdAmount ? `≈ $${balance.usdAmount.toFixed(2)}` : " "} - + {!readOnly && currency.kind === "ibc" && ( <> {currency.deprecated || ( diff --git a/packages/screens/WalletManager/WalletItem.tsx b/packages/screens/WalletManager/WalletItem.tsx index 94d616d8c3..9f73a94fb8 100644 --- a/packages/screens/WalletManager/WalletItem.tsx +++ b/packages/screens/WalletManager/WalletItem.tsx @@ -29,6 +29,12 @@ import { } from "@/store/slices/settings"; import { useAppDispatch } from "@/store/store"; import { neutral33, neutral77 } from "@/utils/style/colors"; +import { + fontRegular12, + fontRegular14, + fontRegular16, + fontRegular18, +} from "@/utils/style/fonts"; import { modalMarginPadding } from "@/utils/style/modals"; interface WalletItemProps { @@ -75,12 +81,7 @@ export const WalletItem: React.FC = ({ zIndex, }} > - + {selectable && ( = ({ - {item.provider} + {item.provider} = ({ marginTop: 8, }} > - - {item.address} - + {item.address} { Clipboard.setStringAsync(item.address); @@ -149,12 +144,7 @@ export const WalletItem: React.FC = ({ - + = ({ }} > Staked - + {`$${delegationsUsdBalance.toFixed(2)}`} - + Pending rewards - + {`$${claimableUSD.toFixed(2)}`} @@ -272,7 +244,7 @@ const DetailsModal: React.FC<{ visible={visible} onClose={onClose} > - + {JSON.stringify(wallet, null, 4)} diff --git a/packages/screens/WalletManager/WalletManagerScreen.tsx b/packages/screens/WalletManager/WalletManagerScreen.tsx index 959f45fae7..21b0a4dee2 100644 --- a/packages/screens/WalletManager/WalletManagerScreen.tsx +++ b/packages/screens/WalletManager/WalletManagerScreen.tsx @@ -15,19 +15,22 @@ import { useAreThereWallets } from "@/hooks/useAreThereWallets"; import { useMaxResolution } from "@/hooks/useMaxResolution"; import { ScreenFC } from "@/utils/navigation"; import { neutral33 } from "@/utils/style/colors"; +import { fontRegular20 } from "@/utils/style/fonts"; import { layout } from "@/utils/style/layout"; export const WalletManagerScreen: ScreenFC<"WalletManager"> = () => { const selectedWallet = useSelectedWallet(); const areThereWallets = useAreThereWallets(); - const { height } = useMaxResolution(); + const { height, width } = useMaxResolution({ isLarge: true }); return ( - }> + }> {areThereWallets ? ( @@ -49,7 +52,7 @@ export const WalletManagerScreen: ScreenFC<"WalletManager"> = () => { zIndex: 99, }} > - + Wallet {!!selectedWallet && ( diff --git a/packages/screens/WalletManager/WalletsScreen.tsx b/packages/screens/WalletManager/WalletsScreen.tsx index 56fdf2ec09..811a66eebd 100644 --- a/packages/screens/WalletManager/WalletsScreen.tsx +++ b/packages/screens/WalletManager/WalletsScreen.tsx @@ -10,20 +10,25 @@ import { ScreenContainer } from "@/components/ScreenContainer"; import { PrimaryButton } from "@/components/buttons/PrimaryButton"; import { ConnectWalletModal } from "@/components/modals/ConnectWalletModal"; import { useWallets } from "@/context/WalletsProvider"; +import { useMaxResolution } from "@/hooks/useMaxResolution"; import { ScreenFC } from "@/utils/navigation"; import { neutral33, neutralA3 } from "@/utils/style/colors"; +import { fontRegular14, fontRegular20 } from "@/utils/style/fonts"; export const WalletManagerWalletsScreen: ScreenFC< "WalletManagerWallets" | "WalletManagerChains" > = () => { const [showConnectModal, setShowConnectModal] = useState(false); const { wallets: allWallets } = useWallets(); + const { width } = useMaxResolution({ isLarge: true }); return ( - }> + }> - + All Wallets - + Manage your wallets diff --git a/packages/utils/style/fonts.ts b/packages/utils/style/fonts.ts index 662240ad18..4b791bbc77 100644 --- a/packages/utils/style/fonts.ts +++ b/packages/utils/style/fonts.ts @@ -243,6 +243,13 @@ export const fontRegular20: TextStyle = { fontFamily: "Exo_400Regular", fontWeight: "400", }; +export const fontRegular18: TextStyle = { + fontSize: 18, + letterSpacing: -(18 * 0.02), + lineHeight: 20, + fontFamily: "Exo_400Regular", + fontWeight: "400", +}; export const fontRegular16: TextStyle = { fontSize: 16, letterSpacing: -(16 * 0.02),