From 76b08312b6e2358a50372f4d71992cd96ef34419 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Paczy=C5=84ski?= Date: Tue, 19 Dec 2023 13:20:59 +0100 Subject: [PATCH] Replace `customStyle` property with `style` --- .../AccountsNotificationPanelAccounts.tsx | 2 +- .../DAppConnection/DAppConnectionInfoBar.tsx | 6 +--- ui/components/NFTs/NFTCollection.tsx | 4 +-- ui/components/NFTs/NFTHover.tsx | 10 +++---- ui/components/NFTs/NFTImage.tsx | 30 ++++++++++--------- ui/components/NFTs/NFTListPortfolio.tsx | 2 +- ui/components/NFTs/NFTPreview.tsx | 2 +- ui/components/NFTs/NFTsExploreBanner.tsx | 2 +- .../OnboardingOpenClaimFlowBanner.tsx | 13 ++------ ui/components/Overview/AccountList.tsx | 10 +++---- ui/components/Send/NFTCollectionAccordion.tsx | 4 +-- ui/components/Send/NFTCollectionListItem.tsx | 10 +++---- ui/components/Shared/PriceDetails.tsx | 4 +-- ui/components/Shared/SharedAccordion.tsx | 10 +++---- ui/components/Shared/SharedBanner.tsx | 29 ++++++------------ ui/components/Shared/SharedCheckbox.tsx | 12 ++++---- ui/components/Shared/SharedDropDown.tsx | 12 ++++---- ui/components/Shared/SharedFileInput.tsx | 8 ++--- ui/components/Shared/SharedIcon.tsx | 17 ++++------- .../Shared/SharedImageWithFallback.tsx | 29 ++++++++++-------- ui/components/Shared/SharedSkeletonLoader.tsx | 20 ++++++------- ui/components/Shared/SharedSlideUpMenu.tsx | 8 ++--- .../Shared/SharedSlideUpMenuPanel.tsx | 2 +- ui/components/Shared/SharedTooltip.tsx | 8 ++--- .../DetailsPanel.tsx | 4 +-- .../TransactionSignatureDetailsWarning.tsx | 6 +--- ui/components/Signing/index.tsx | 2 +- ui/components/TopMenu/TopMenu.tsx | 2 +- .../TopMenu/TopMenuProtocolListFooter.tsx | 2 +- ui/components/Wallet/Banner/PortalBanner.tsx | 23 ++++---------- ui/components/Wallet/Banner/WalletBanner.tsx | 6 +--- .../UnverifiedAsset/UnverifiedAssetBanner.tsx | 8 ++--- .../Wallet/WalletAccountBalanceControl.tsx | 6 ++-- .../Wallet/WalletActivityDetails.tsx | 2 +- .../WalletAnalyticsNotificationBanner.tsx | 6 ++-- ui/components/Wallet/WalletHiddenAssets.tsx | 2 +- ui/components/Wallet/WalletSubscapeLink.tsx | 4 +-- ui/pages/Abilities/AbilityCard.tsx | 2 +- ui/pages/Abilities/AbilityFilter.tsx | 2 +- ui/pages/Earn.tsx | 4 +-- ui/pages/Earn/NotificationVaults.tsx | 2 +- ui/pages/NewCustomNetworkRequest.tsx | 2 +- .../Onboarding/Tabbed/AddWalletOptions.tsx | 2 +- ui/pages/Settings.tsx | 6 ++-- .../Settings/ConnectedWebsitesListItem.tsx | 2 +- ui/pages/Settings/SettingsAddCustomAsset.tsx | 10 +++---- ui/pages/SingleAsset.tsx | 2 +- ui/pages/Swap.tsx | 4 +-- ui/pages/Wallet.tsx | 2 +- 49 files changed, 159 insertions(+), 208 deletions(-) diff --git a/ui/components/AccountsNotificationPanel/AccountsNotificationPanelAccounts.tsx b/ui/components/AccountsNotificationPanel/AccountsNotificationPanelAccounts.tsx index 8dc5703077..5b0815a284 100644 --- a/ui/components/AccountsNotificationPanel/AccountsNotificationPanelAccounts.tsx +++ b/ui/components/AccountsNotificationPanel/AccountsNotificationPanelAccounts.tsx @@ -195,7 +195,7 @@ function WalletTypeHeader({ toggler={(toggle) => ( toggle()} icon="settings.svg" diff --git a/ui/components/DAppConnection/DAppConnectionInfoBar.tsx b/ui/components/DAppConnection/DAppConnectionInfoBar.tsx index 6abd6edf3c..4527c18e4d 100644 --- a/ui/components/DAppConnection/DAppConnectionInfoBar.tsx +++ b/ui/components/DAppConnection/DAppConnectionInfoBar.tsx @@ -41,11 +41,7 @@ function DefaultConnectionPopover({ close }: PopoverProps): ReactElement { onClick={animateThenClose} color="var(--green-20)" hoverColor="var(--white)" - customStyles={` - position: absolute; - top: 16px; - right: 16px; - `} + style={{ position: "absolute", top: 16, right: 16 }} />

{t("title")}

diff --git a/ui/components/NFTs/NFTCollection.tsx b/ui/components/NFTs/NFTCollection.tsx index 7e59fbec21..8b68298dd9 100644 --- a/ui/components/NFTs/NFTCollection.tsx +++ b/ui/components/NFTs/NFTCollection.tsx @@ -133,7 +133,7 @@ export default function NFTCollection(props: { isLoaded={!isLoading && !!nfts.length} width={168} height={168} - customStyles="margin: 8px 0 34px;" + style={{ margin: "8px 0 34px" }} > {nfts.length === 1 ? (
diff --git a/ui/components/NFTs/NFTHover.tsx b/ui/components/NFTs/NFTHover.tsx index 55857fc8f2..0440b900d6 100644 --- a/ui/components/NFTs/NFTHover.tsx +++ b/ui/components/NFTs/NFTHover.tsx @@ -1,5 +1,5 @@ /* eslint-disable no-nested-ternary */ -import React, { ReactElement } from "react" +import React, { CSSProperties, ReactElement } from "react" import { useTranslation } from "react-i18next" import { I18nKey } from "../../_locales/i18n" import SharedIcon from "../Shared/SharedIcon" @@ -12,7 +12,7 @@ const icons: Record< background: string backgroundHover?: string size: number - style: string + style?: CSSProperties } > = { close: { @@ -21,21 +21,19 @@ const icons: Record< background: "var(--green-40)", backgroundHover: "var(--green-20)", size: 12, - style: "", }, expand: { icon: "chevron", label: "nfts.collectionHover.expand", background: "var(--success)", size: 12, - style: "margin-bottom: 3px;", + style: { marginBottom: 3 }, }, view: { icon: "eye", label: "nfts.collectionHover.view", background: "var(--trophy-gold)", size: 22, - style: "", }, } @@ -72,7 +70,7 @@ export default function NFTsHover(props: { icon={`${icon}@2x.png`} width={size} color="var(--hunter-green)" - customStyles={style} + style={style} />
diff --git a/ui/components/Shared/SharedImageWithFallback.tsx b/ui/components/Shared/SharedImageWithFallback.tsx index 1c94d81049..9ec5a5de65 100644 --- a/ui/components/Shared/SharedImageWithFallback.tsx +++ b/ui/components/Shared/SharedImageWithFallback.tsx @@ -1,10 +1,23 @@ -import React, { PropsWithoutRef, useEffect, useState } from "react" +import React, { + CSSProperties, + PropsWithoutRef, + useEffect, + useState, +} from "react" import classNames from "classnames" // Transparent pixel const defaultPlaceholder = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" +type SharedImageWithFallbackProps = PropsWithoutRef< + JSX.IntrinsicElements["img"] +> & { + fallback: string + placeholder?: string + style?: CSSProperties +} + export default function SharedImageWithFallback({ fallback, src = fallback, @@ -13,13 +26,9 @@ export default function SharedImageWithFallback({ loading, alt, className, - customStyles = "", + style, placeholder = defaultPlaceholder, -}: PropsWithoutRef & { - fallback: string - placeholder?: string - customStyles?: string -}): JSX.Element { +}: SharedImageWithFallbackProps): JSX.Element { const [isLoading, setIsLoading] = useState(true) const [imageSrc, setImageSrc] = useState(placeholder) @@ -49,6 +58,7 @@ export default function SharedImageWithFallback({ - ) } diff --git a/ui/components/Shared/SharedSkeletonLoader.tsx b/ui/components/Shared/SharedSkeletonLoader.tsx index 413ab97c9e..17d204f26b 100644 --- a/ui/components/Shared/SharedSkeletonLoader.tsx +++ b/ui/components/Shared/SharedSkeletonLoader.tsx @@ -1,4 +1,4 @@ -import React, { ReactElement, ReactNode } from "react" +import React, { CSSProperties, ReactElement, ReactNode } from "react" import classNames from "classnames" export default function SharedSkeletonLoader(props: { @@ -7,10 +7,9 @@ export default function SharedSkeletonLoader(props: { borderRadius?: number children?: ReactNode isLoaded?: boolean - customStyles?: string + style?: CSSProperties }): ReactElement { - const { width, height, borderRadius, isLoaded, customStyles, children } = - props + const { width, height, borderRadius, isLoaded, style, children } = props // Want to return a ReactElement to make this maximally easy to integrate, // whereas children can be a ReactNode; Fragment will let us achieve that. @@ -18,7 +17,11 @@ export default function SharedSkeletonLoader(props: { if (isLoaded) return <>{children} return ( -
+